ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1094. E-screen

pls 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
Posted by Knot Skycreeper[th] 10 Oct 2002 21:16
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!!
Posted by Pai.tu64[th] 11 Oct 2002 21:33
> 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...