青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

posts - 21, comments - 2, trackbacks - 0, articles - 0
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=61
數(shù)據(jù)結(jié)構(gòu),用C寫的棧,不用STL確實(shí)復(fù)雜多了,WA了幾次~
Standard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can be reached by moving backward and forward. In this problem, you are asked to implement this.

The following commands need to be supported:

BACK: Push the current page on the top of the forward stack. Pop the page from the top of the backward stack, making it the new current page. If the backward stack is empty, the command is ignored.

FORWARD: Push the current page on the top of the backward stack. Pop the page from the top of the forward stack, making it the new current page. If the forward stack is empty, the command is ignored.

VISIT <url>: Push the current page on the top of the backward stack, and make the URL specified the new current page. The forward stack is emptied.

QUIT: Quit the browser.

Assume that the browser initially loads the web page at the URL http://www.acm.org/


This problem contains multiple test cases!

The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks.

The output format consists of N output blocks. There is a blank line between output blocks.


Input

Input is a sequence of commands. The command keywords BACK, FORWARD, VISIT, and QUIT are all in uppercase. URLs have no whitespace and have at most 70 characters. You may assume that no problem instance requires more than 100 elements in each stack at any time. The end of input is indicated by the QUIT command.

Output

For each command other than QUIT, print the URL of the current page after the command is executed if the command is not ignored. Otherwise, print "Ignored". The output for each command should be printed on its own line. No output is produced for the QUIT command.

Sample Input

1

VISIT http://acm.ashland.edu/
VISIT http://acm.baylor.edu/acmicpc/
BACK
BACK
BACK
FORWARD
VISIT http://www.ibm.com/
BACK
BACK
FORWARD
FORWARD
FORWARD
QUIT

Sample Output

http://acm.ashland.edu/
http://acm.baylor.edu/acmicpc/
http://acm.ashland.edu/
http://www.acm.org/
Ignored
http://acm.ashland.edu/
http://www.ibm.com/
http://acm.ashland.edu/
http://www.acm.org/
http://acm.ashland.edu/
http://www.ibm.com/
Ignored

AC代碼:

#include<stdio.h>
#include
<string.h>
#include
<malloc.h>
#define StackSize 105
typedef 
struct
{
    
char elemt[StackSize][73];
    
int top;
}
Stack;
void InitStack(Stack *S)
{
      S
->top=-1;
}

int ElemtNum(Stack *S)
{
    
return (S->top)+1;
}

int IsFull(Stack *S)
{
    
return(S->top==StackSize-1?1:0);
}

int PushStack(Stack *S,char *x)
{
    
if(IsFull(S))  
        
return 0;
    S
->top++;
    memset(S
->elemt[S->top],'\0',sizeof(S->elemt[S->top]));
    strcpy(S
->elemt[S->top],x);
    
return 1;
}

int PopStack(Stack *S,char *x)
{  
    
if(ElemtNum(S)==0)
        
return 0;
    memset(x,
0,sizeof(x));
      strcpy(x,S
->elemt[S->top]);
    memset(S
->elemt[S->top],0,sizeof(S->elemt[S->top]));
    S
->top--;
      
return 1;
}

int GetTopElemt(Stack *S,char *x)
{
    
if(ElemtNum(S)==0)
        
return 0;
      memset(x,
0,sizeof(x));
      strcpy(x,S
->elemt[S->top]);
      
return 1;
}

int main()
{
    Stack 
*sBack,*sForward;
    sBack
=(Stack *)malloc(sizeof(Stack));
    sForward
=(Stack *)malloc(sizeof(Stack));
    
int T;char str[73]="\0",comd[8]="\0",tmp[73]="\0";
    scanf(
"%d",&T);
    
while(T--)
    
{
        InitStack(sBack); InitStack(sForward);
        PushStack(sBack,
"http://www.acm.org/");
        
while(1)
        
{
            memset(comd,
0,sizeof(comd));
            scanf(
"%s",comd);
            
if(strcmp(comd,"BACK")==0)
            
{
                
if(ElemtNum(sBack)==1)
                
{
                    printf(
"Ignored\n");
                    
continue;
                }

                PopStack(sBack,tmp);
                PushStack(sForward,tmp);
                
if(GetTopElemt(sBack,tmp)==1)
                    printf(
"%s\n",tmp);
            }

            
else if(strcmp(comd,"FORWARD")==0)
            
{
                
if(ElemtNum(sForward)==0)
                
{
                    printf(
"Ignored\n");
                    
continue;
                }

                PopStack(sForward,tmp);
                PushStack(sBack,tmp);
                
if(GetTopElemt(sBack,tmp)==1)
                    printf(
"%s\n",tmp);
            }

            
else if(strcmp(comd,"VISIT")==0)
            
{
                memset(str,
0,sizeof(str));
                scanf(
"%s",str);
                printf(
"%s\n",str);
                PushStack(sBack,str);
                InitStack(sForward);
            }

            
else if(strcmp(comd,"QUIT")==0)
                
break;
        }

        
if(T>0) printf("\n");
    }

    free(sBack);free(sForward);
    
return 0;
}


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲九九精品| 午夜久久电影网| 亚洲三级电影全部在线观看高清| 韩国精品主播一区二区在线观看| 加勒比av一区二区| 亚洲第一精品影视| 亚洲精品美女久久7777777| 亚洲精品日韩激情在线电影 | 亚洲毛片在线免费观看| 亚洲精品日韩精品| 一本色道久久99精品综合| 亚洲视频1区2区| 午夜在线视频观看日韩17c| 欧美一区二区在线看| 久久精品1区| 老司机一区二区| 欧美喷潮久久久xxxxx| 国产精品a久久久久久| 国产精品女同互慰在线看| 国产一区三区三区| 亚洲国产精品免费| 亚洲特黄一级片| 欧美在线观看一二区| 麻豆精品在线观看| 日韩视频永久免费| 性欧美xxxx大乳国产app| 久久久亚洲国产美女国产盗摄| 欧美粗暴jizz性欧美20| 欧美午夜精品久久久久久人妖 | 亚洲国产第一页| 91久久久久久| 亚洲综合首页| 久热这里只精品99re8久| 欧美日韩精品| 国产综合在线视频| 日韩午夜电影在线观看| 欧美在线观看你懂的| 欧美激情一区二区三区成人| 一区二区三区色| 久久久久久夜| 欧美性感一类影片在线播放| 激情久久中文字幕| 亚洲视频免费看| 毛片精品免费在线观看| 一区二区三区回区在观看免费视频| 欧美一区二区精品在线| 欧美成人激情视频免费观看| 国产精品美女在线观看| 亚洲精品美女在线观看| 久久九九精品99国产精品| 亚洲日本va午夜在线影院| 欧美一级电影久久| 欧美日韩亚洲一区二区| 在线精品亚洲| 欧美专区第一页| 亚洲精选国产| 久久亚洲欧洲| 国产日本欧美一区二区三区在线| 日韩一级黄色av| 美女主播视频一区| 亚洲欧美日韩一区二区三区在线观看 | 久久免费一区| 亚洲一区二区在线免费观看视频 | 久久综合色播五月| 亚洲一区二区三区久久| 欧美成人小视频| 在线不卡a资源高清| 欧美一区二区三区日韩| 日韩一级精品| 欧美国产一区二区在线观看| 一区免费在线| 久久久精彩视频| 亚洲一区二区三区在线视频| 欧美另类人妖| 亚洲精品乱码久久久久久日本蜜臀 | 亚洲一区久久久| 亚洲日本欧美在线| 裸体女人亚洲精品一区| 国外成人在线视频| 久久大逼视频| 亚洲免费视频成人| 国产精品女人毛片| 亚洲欧美成人一区二区三区| 亚洲美女免费视频| 欧美日韩激情网| 一本色道久久加勒比精品| 亚洲国产成人精品女人久久久 | 一区二区三区产品免费精品久久75| 免费在线播放第一区高清av| 欧美在线视频二区| 国模精品一区二区三区| 久久精品国产999大香线蕉| 亚洲摸下面视频| 国产精品一区二区欧美| 午夜精品亚洲| 亚洲欧美影院| 国产婷婷精品| 可以免费看不卡的av网站| 久久成人一区二区| 在线观看成人小视频| 你懂的国产精品| 欧美 日韩 国产在线| 亚洲激情影视| 最近中文字幕日韩精品| 欧美成人a视频| 欧美成人精品不卡视频在线观看| 最新精品在线| 日韩午夜三级在线| 国产精品色网| 久久久久久高潮国产精品视| 久久久久久穴| 亚洲欧洲美洲综合色网| 亚洲精品乱码久久久久久蜜桃麻豆| 欧美极品一区| 亚洲欧美久久久| 午夜精品三级视频福利| 国一区二区在线观看| 欧美成人一区在线| 欧美成人在线网站| 亚洲伊人观看| 欧美有码在线视频| 亚洲人成在线播放网站岛国| 亚洲精品乱码久久久久久久久| 欧美色中文字幕| 欧美一区二区三区电影在线观看| 欧美在线短视频| 亚洲经典一区| 一区二区三区.www| 国内成人在线| 亚洲欧洲精品一区二区精品久久久| 欧美日韩免费观看中文| 久久精品91| 欧美激情国产日韩精品一区18| 亚洲图片欧洲图片av| 欧美一区二视频在线免费观看| 在线视频成人| 一区二区三区欧美亚洲| 好吊一区二区三区| 亚洲精品影视| 国内精品国语自产拍在线观看| 欧美激情网站在线观看| 国产精品青草久久| 欧美11—12娇小xxxx| 国产精品a久久久久| 免费久久99精品国产| 欧美色区777第一页| 久久综合伊人77777| 欧美日韩亚洲一区二区三区在线观看| 欧美在线视频不卡| 欧美精品日韩综合在线| 久久精品成人| 欧美日韩综合久久| 麻豆久久婷婷| 国产精品爽爽ⅴa在线观看| 欧美激情精品久久久久久久变态| 国产精品乱码| 亚洲国产三级| 激情综合电影网| 亚洲深夜福利视频| 亚洲免费电影在线| 久久久久久久999| 欧美一区二区三区婷婷月色 | 一本一本a久久| 久久精品人人爽| 午夜精品www| 欧美日韩国产精品| 欧美成人免费小视频| 国产日韩精品久久| 99精品国产一区二区青青牛奶| 亚洲国产日韩欧美综合久久 | 午夜精品久久久久久久久久久久| 久久亚裔精品欧美| 久久激情五月丁香伊人| 欧美日韩一区二区三区在线| 欧美成人xxx| 精品999网站| 午夜一区二区三区在线观看| 亚洲一卡久久| 欧美日韩国产成人精品| 亚洲二区视频在线| 亚洲国产成人91精品| 久久精品国产99国产精品| 欧美亚洲一区二区在线观看| 欧美深夜福利| 亚洲伦理在线免费看| 99精品久久免费看蜜臀剧情介绍| 久久中文欧美| 欧美a级片网| 在线看日韩av| 久久午夜色播影院免费高清| 久久天天狠狠| 国内精品久久久久久久影视蜜臀| 亚洲欧美日韩一区| 欧美一区二区三区久久精品| 国产精品入口麻豆原神| 亚洲图片激情小说| 午夜精品久久久久久久久| 国产精品乱人伦一区二区| 亚洲专区在线| 欧美主播一区二区三区|