好吧我錯了,我不應該亂用break;
應該要明確到某個步驟跳出 不然都不知道break到哪裡去了
在此附上修改版本供參考
#include <stdio.h>
#include <stdlib.h>
void ii()
{
char c;
long long int x,y,z,w,n,m;
scanf("%lld %lld %lld %lld %lld %lld",&x,&y,&z,&w,&n,&m);
getchar();
z*=-1;
w*=-1;
n*=-1;
/*pºâ¹Lµ{*/
long long int weight=m;
long long int dou=0;
long long int poison=0;
while((c=getchar())!='\n')
{
if(c>='0' &&c<='9')
{
if(poison==1)
weight+=dou;
if(weight<=0)
{
printf("bye~Rabbit\n");
while(getchar()!='\n');
return;
}
switch(c)
{
case '0':
break;
case '1':
weight+=x;
break;
case '2':
weight+=y;
break;
case '3':
weight+=z;
break;
case '4':
weight+=w;
dou+=n;
poison=1;
break;
}
}
if(weight<=0)
{
printf("bye~Rabbit\n");
while(getchar()!='\n');
return;
}
}
if(weight>0)
printf("%lldg\n",weight);
else
{
printf("bye~Rabbit\n");
while(getchar()!='\n');
return;
}
}
int main()
{
int i,run;
scanf("%d",&run);
for(i=1;i<=run;i++)
{
ii();
}
return 0;
}