#include<bits/stdc++.h>
using namespace std;
struct cb{
char cmd[51];
int num;
int time;
int pause;
int gs;
}command[11];
int jy=0,x,y;
void ks(int type,int i)
{
switch(type)
{
int f;
case 1:
for(f=14;command[i].cmd[f]!=' ';f++)
{
command[i].num=command[i].num*10+command[i].cmd[f]-'0';
}
for(f=f+1;command[i].cmd[f]!=' ';f++)
{
command[i].time=command[i].time*10+(command[i].cmd[f]-'0');
}
for(f=f+1;command[i].cmd[f]!=' ';f++)
{
command[i].pause=command[i].pause*10+(command[i].cmd[f]-'0');
}
for(f=f+1;command[i].cmd[f]!=' '&&command[i].cmd[f]!='\0';f++)
{
command[i].gs=command[i].gs*10+(command[i].cmd[f]-'0');
}
jy=jy+command[i].gs*command[i].time;
jy=jy-command[i].time*y-command[i].pause*y;
break;
case 2:
for(f=17;command[i].cmd[f]!=' ';f++)
{
command[i].num=command[i].num*10+(command[i].cmd[f]-'0');
}
for(f=f+1;command[i].cmd[f]!=' ';f++)
{
command[i].time=command[i].time*10+(command[i].cmd[f]-'0');
}
for(f=f+1;command[i].cmd[f]!=' ';f++)
{
command[i].pause=command[i].pause*10+(command[i].cmd[f]-'0');
}
for(f=f+1;command[i].cmd[f]!=' '&&command[i].cmd[f]!='\0';f++)
{
command[i].gs=command[i].gs*10+(command[i].cmd[f]-'0');
}
jy=jy+command[i].gs*3*command[i].time;
jy=jy-command[i].time*y-command[i].pause*y;
break;
case 3:
for(f=12;command[i].cmd[f]!=' ';f++)
{
command[i].num=command[i].num*10+(command[i].cmd[f]-'0');
}
for(f=f+1;command[i].cmd[f]!=' '&&command[i].cmd[f]!='\0';f++)
{
command[i].gs=command[i].gs*10+(command[i].cmd[f]-'0');
}
jy=jy-command[i].gs;
break;
}
if(jy>x)
{
cout<<"Zombie\n";
cout<<command[i].num<<" "<<jy;
exit(0);
}
if(jy<0)
jy=0;
}
int main()
{
int n;
cin>>n>>x;
for(int i=0;i<=n;i++)
gets(command[i].cmd);
cin>>y;
for(int i=1;i<=n;i++)
{
int type;
if(command[i].cmd[10]=='o')
type=1;
if(command[i].cmd[11]=='o')
type=2;
if(command[i].cmd[7]=='_')
type=3;
ks(type,i);
}
cout<<"Reuben";
return 0;
}
看了帮助,好像没说解决方法啊 @kkksc03 @lin_toto