Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:那位哥哥帮忙看看啊~~~~~~~~~~~~~WA得我疯了!!!!谢谢拉In Reply To:那位哥哥帮忙看看啊~~~~~~~~~~~~~WA得我疯了!!!!谢谢拉 Posted by:trueshlqsh at 2007-09-20 20:04:29 感觉我的代码和你的差不多啊 竟然奇迹般的AC了。。。。。 #include<iostream> #include<string> using namespace std; int main() { string get,forward[100],back[100],now; int f=0,b=0; now="http://www.acm.org/"; while(cin>>get,get!="QUIT") { if(get=="VISIT"){ back[++b]=now; cin>>now; cout<<now<<endl; f=0; continue; } if(get=="BACK"){ if(b==0) {printf("Ignored\n");continue;} else { forward[++f]=now; now=back[b--]; cout<<now<<endl; continue; } } if(get=="FORWARD"){ if(f==0) {printf("Ignored\n");continue;} else { back[++b]=now; now=forward[f--]; cout<<now<<endl; continue; } } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator