#34533: 請高手幫忙debug，讓我AC吧~!

ope22331 (ope)

School : No School
ID : 220874
2023-06-03 17:00:22
a271. 彩色蘿蔔 -- | From: [36.227.132.55] | Post Date : 2023-03-27 23:18

#1: 90% WA (line:27920)

您的答案為: bye~Rabbit ...略

#include <iostream>
#include<string>
using namespace std;
int main()
{   int num,x,y,z,w,n,m,i,j;
string eat;
cin>>num;
while(num--&&cin>>x>>y>>z>>w>>n>>m)
{   if(m<=0){cout<<"bye~Rabbit\n";continue;}
int total=m;
int floag=0;
getline(cin,eat);
getline(cin,eat);
int ans[eat.length()];
if(eat.length()==0){cout<<m<<"g"<<"\n";continue;}
for(i=0;i<eat.length();i=i+2)
{   if(floag!=0)
{   for(j=1;j<=floag;j++)
{   total=total-n;
}}
if(total>0)
{ ans[i]=eat[i]-'0';
switch(ans[i])
{   case 0:;break;
case 1:total+=x;break;
case 2:total+=y;break;
case 3:total-=z;break;
case 4:total=total-w;floag++;break;
}}
else break;
}
if(total>0)cout<<total<<"g"<<"\n";
else cout<<"bye~Rabbit\n";

}

return 0;

}

#34578: Re: 請高手幫忙debug，讓我AC吧~!

cges30901 (cges30901)

School : No School
ID : 30877
2023-06-04 19:25:43
a271. 彩色蘿蔔 -- | From: [118.231.152.169] | Post Date : 2023-04-01 19:56

   if(m<=0){cout<<"bye~Rabbit\n";continue;}


#34659: Re: 請高手幫忙debug，讓我AC吧~!

ope22331 (ope)

School : No School
ID : 220874
2023-06-03 17:00:22
a271. 彩色蘿蔔 -- | From: [120.106.136.8] | Post Date : 2023-04-06 09:37

   if(m<=0){cout<<"bye~Rabbit\n";continue;}


ZeroJudge Forum