#19820: _WTF


jack621224 (YJLegend)


AC

#include #include using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); int c; cin >> c; for(;c>0;c--){ int x,y,z,w,n,m,poi=0; cin >> x >> y >> z >> w >> n >> m; stringstream stream; string s; getline(cin ,s); getline(cin,s); stream<<s; int type=0; do{ m-=poi; if(m<=0) break; if(type==1) m+=x; else if(type==2) m+=y; else if(type==3) m-=z; else if(type==4) {m-=w;poi+=n;} }while(stream>>type); if(m>0) cout << m << "g\n" ; else cout << "bye~Rabbit\n"; } }

WA

 

#include #include using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); int c; cin >> c; for(;c>0;c--){ int x,y,z,w,n,m,poi=0; cin >> x >> y >> z >> w >> n >> m; stringstream stream; string s; getline(cin ,s); getline(cin,s); stream<<s; int type=0; while(stream>>type){ m-=poi; if(m<=0) break; if(type==1) m+=x; else if(type==2) m+=y; else if(type==3) m-=z; else if(type==4) {m-=w;poi+=n;} } if(m>0) cout << m << "g\n" ; else cout << "bye~Rabbit\n"; } }

#19822: Re:WTF


jack621224 (YJLegend)


為什麼while法會錯do-while會對WTF

是因為測資有第一天體重就0的???