Wrong Answer
foo.cc: In function 'int main()': foo.cc:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] 10 | scanf("%s",st); | ~~~~~^~~~~~~~~ foo.cc:24:8: warning: 'time1' is used uninitialized in this function [-Wuninitialized] 24 | time1+=time; | ~~~~~^~~~~~
[Hydro](https://hydro.ac)提供评测服务
代码
#include <bits/stdc++.h>
using namespace std;
struct l{
int Q_num,Per_iod;
}x[10001];
int main(){
char st[20];
int b,t=0,m=0,time=100000000,time1;
for(int i=1;i<=10001;i++){
scanf("%s",st);
if(st[0]=='#')
{
break;
}
else
{
cin>>x[i].Q_num>>x[i].Per_iod;
time=min(time,x[i].Per_iod);
t++;
}
}
cin>>b;
//while(m<b){
time1+=time;
for(int i=t;i>=1;i--){
if(time1>=x[i].Per_iod){
cout<<x[i].Q_num<<endl;
x[i].Per_iod+=x[i].Per_iod;
m++;
}
}
//}
return 0;
}