-
//zoj1061 Web Navigation
-
//Accepted 1061 C ++ 00:00.03 852K
-
#include <iostream>
-
#include <string>
-
#include <cstdio>
-
using namespace std;
-
-
void solve()
-
{
-
char t[10],s[101][71]={"http://www.acm.org/"};
-
int cnt=1,pos=0;
-
while (1){
-
cin >> t;
-
if (strcmp(t,"QUIT")==0) break;
-
if (strcmp(t,"VISIT")==0){
-
pos++;
-
cin >> s[pos];
-
cout << s[pos] << endl;
-
cnt = pos+1;
-
}
-
if (strcmp(t,"BACK")==0){
-
pos--;
-
if (pos<0) {
-
pos = 0;
-
cout << "Ignored" << endl;
-
}
-
else cout << s[pos] << endl;
-
}
-
if (strcmp(t,"FORWARD")==0){
-
pos++;
-
if (pos<cnt) cout << s[pos] << endl;
-
else {
-
pos = cnt-1;
-
cout << "Ignored" << endl;
-
}
-
}
-
}
-
}
-
-
int main()
-
{
-
#ifdef ONLINE_JUDGE
-
#else
-
freopen("1061.txt","r",stdin);
-
#endif
-
int n;
-
while (cin >> n)
-
for (int i=0; i<n; ++i){
-
if (i>0) cout << endl;
-
solve();
-
}
-
#ifdef ONLINE_JUDGE
-
#else
-
fclose(stdin);
-
#endif
-
return 0;
-
}
zoj1061 Web Navigation
最新推荐文章于 2016-02-09 10:48:06 发布