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 |
谁能给一组测试数据。WA了几次了#include"stdio.h" #include"string.h" void main() { char a[120][120]; char r[120][120]; char s[120]; int i,j=0,max=0; strcpy(a[0],"http://www.acm.org/"); i=0; while(gets(s)&&s[0]!='Q') { if(s[0]=='V') { i++; max=i; strcpy(a[i],s+6); strcpy(r[j++],a[i]); continue; } if(s[0]=='F') { i++; if(i>max) { i=max; strcpy(r[j++],"Ignored"); } else strcpy(r[j++],a[i]); continue; } if(s[0]=='B') { i--; if(i==-1) { i=0; strcpy(r[j++],"Ignored"); } else strcpy(r[j++],a[i]); } } for(i=0;i<j;i++) printf("%s\n",r[i]); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator