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 1404. Easy to Hack!

Why WA#1??
Posted by Baranina 5 Feb 2008 16:58
#include <cstdio>

int n,m,i,l,t[201];
char s[201];

int main()
{
 scanf("%s",s);
 n=0;
 while(s[n])t[n]=s[n++]-'a';
 m=5;
 for(i=0;i<n;i++)
 {
  l=(26+t[i]-m)%26;
  printf("%c",97+l);
  m=t[i];
 }
 printf("\n");
 return 0;
}

Edited by author 11.04.2008 23:51
Re: Why WA#1??
Posted by inkognito 19 Feb 2008 22:30
don't use namespace std here! And you will get Ac!
Re: Why WA#1??
Posted by Baranina 11 Apr 2008 23:51
sorry but still WA#1
Re: Why WA#1??
Posted by Denis Koshman 24 Jul 2008 18:13
try avoiding \n in the end. At least my AC doesn't.
Re: Why WA#1??
Posted by Anton 16 Nov 2011 20:17
Have you fixed WA1 ?
Re: Why WA#1??
Posted by Anton 16 Nov 2011 20:29
I've go AC. WA#1 took place, cause there is some trash in input.
It's very very not fear for admins/judges not to warn about it in problem statement !
WA#1
Posted by pikavel 14 Mar 2012 14:43
Got AC with reading a string, and WA#1 with symbol reading (commented block), but both ways of reading work correctly on my computer. It seems that input consists EOL symbol '\n'.

int main() {

    char c;
    int n=0;
    char sym[101];
    int code[101];

    scanf("%s",sym);
    n=strlen(sym);
    for (int i=0;i<n;i++) code[i]=sym[i]-0x61;

/*
    while (scanf("%c",&c)!=EOF) {
          code[n]=c-0x61;
          n++;
    }
*/
  ...