hdu Web Navigation (模拟,只需注意vist后,没有forward)

来源:互联网 发布:阿里云 多隆 编辑:程序博客网 时间:2024/05/16 11:17
#include <stdio.h>#include <string.h>char web[10000][75];int main(){    char command[10];    int i = 0,j;    memset(web,'\0',sizeof(web));    while(1){        scanf("%s",command);        if(command[0] == 'V'){            i++;            scanf("%s",web[i]);            printf("%s\n",web[i]);            for(j = i + 1;j < 10000;j++)                web[j][0] = '\0';        }        else if(command[0] == 'B'){            if(i == 0){                printf("Ignored\n");            }            else if(i == 1){                printf("http://www.acm.org/\n");                i--;            }            else{                i--;                printf("%s\n",web[i]);            }        }        else if(command[0] == 'F'){            i++;            if(web[i][0] != '\0'){                printf("%s\n",web[i]);            }            else{                printf("Ignored\n");                i--;            }        }        else{            break;        }    }    return 0;}