您的答案為: bye~Rabbit ...略 正確答案為: 4861g
#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; }