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 1098. Questions

Maybe somebody can explain me, why i received WA3.
Posted by LaE 3 Aug 2006 13:45
Everything seems to be Ok, but wa3! Josepth algo works correctly (to my mind).
Maybe i must skip not only '\n', but something else.
Here is source:

#include<stdio.h>
char str[30010];
int len=0;
int main()
{
    while(!feof(stdin))
    {
        scanf("%c",&str[len]);
        if(str[len]!='\n')len++;
    }
    int res=0;
    for(int i=1;i<=len-1;i++) res=(res+1999)%i;
    if(str[res]=='?') printf("Yes");
    else
    {
        if(str[res]==' ') printf("No");
        else printf("No comments");
    }
    return 0;
}