计蒜客练习题:网页跳转
题目
样例
代码
#include<stdio.h>
#include<string.h>
int main()
{
char http[100010][105];
int n,f,top=-1,l=-1;
char s[105];
scanf("%d",&n);
while(n--)
{
scanf("%s",s);
if(s[0]=='V')
{
scanf("%s",http[++top]);
l=top;
f=1;
}
if(s[0]=='B')
{
if(top<=0) f=0;
else
{
top--;
f=1;
}
}
if(s[0]=='F')
{
if(top<l)
{
top++;
f=1;
}
else f=0;
}
if(f) printf("%s\n",http[top]);
else printf("Ignore\n");
}
return 0;
}