|
|
back to boardpls help i got WA for about 7 time Posted by BoRN 9 Oct 2002 20:50 #include <stdio.h> char ans[80]; int main() { int i,current=0,maxreach=0; char ch; for(i=0;i<80;i++) ans[i]=' '; while((ch=getc(stdin))!=-1){ if(ch=='\n') NULL; else if(ch=='<'){ if(current>0) current-=1; } else if(ch=='>'){ if(current>maxreach) maxreach=current; if(current<79) current+=1; if(current=79) current=0; } else{ if(current>maxreach) maxreach=current; ans[current]=ch; current=(current+1)%80; } } for(i=0;i<=maxreach;i++) printf("%c",ans[i]); return 0; } Re: pls help i got WA for about 7 time hey,, piched it says: "INPUT: The single line of the input contains a sequence of..." it says: "SINGLE LINE OF INPUT" i think this would help you... Thanx, I have been confused of this for about 1/2 hrs!! > hey,, piched > > it says: "INPUT: The single line of the input contains a sequence of..." > > it says: "SINGLE LINE OF INPUT" > > i think this would help you... |
|
|