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 |
我的怎么老是超时,请各位高手看看!#include<stdio.h> #include<string.h> #define MAX1 100 #define MAX2 60 typedef struct { char save[MAX1][MAX2]; int top; }stack; void main() { stack *bk,*fw; char cur_str[MAX2]={"http://www.acm.org/"}; char get_str[MAX2]; char c,temp; int i,j,tag; bk->top=-1; fw->top=-1; while(1) { j=0; gets(get_str); c=(int)get_str[0]; for(i=0;get_str[i]!=' ';i++); while(get_str[++i]) get_str[j++]=get_str[i]; get_str[j]='\0'; if(c!=81) {switch(c) { case 86: strcpy(bk->save[++(bk->top)],cur_str); strcpy(cur_str,get_str); printf("%s\n",cur_str); fw->top=-1; break; case 66: if(bk->top!=-1) { strcpy(fw->save[++(fw->top)],cur_str); strcpy(cur_str,bk->save[(bk->top)--]); printf("%s\n",cur_str); } else printf("Ignored\n"); break; case 70: if(fw->top!=-1) { strcpy(bk->save[++(bk->top)],cur_str); strcpy(cur_str,fw->save[(fw->top)--]); printf("%s\n",cur_str); } else printf("Ignored\n"); break; } } else {printf("Ignored\n"); break;} } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator