我用手動輸入範例給的測資,答案都對;但是用系統的測試,答案就錯了
頭好痛,大家救救我QQ
-------------------------------
#include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
int a,b,c,d,e,weight;
scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&weight);
fflush(stdin);
int y , poison=0;
char cy; scanf("%c",&cy);
while(cy!=10)
{
if(cy==' ')
{
scanf("%c",&cy); continue;
}
y=cy-48;
weight-=poison;
if(weight<1) break;
if(y==1) weight+=a;
else if(y==2) weight+=b;
else if(y==3) weight-=c;
else if(y==4)
{
weight-=d; poison+=e;
}
if(weight<1) break;
scanf("%c",&cy);
}
if(weight<1) printf("bye~Rabbit\n");
else printf("%dg\n",weight);
}
}