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

Common Board

WA 1404
Posted by Mishex 22 Feb 2008 03:10
Hi, please, tell me
Why do my task solve number 1404 take WA#1:

#include <stdio.h>

char Change(char ch);

int main()
{
 #ifndef ONLINE_JUDGE
  freopen("input.txt", "rt", stdin);
  freopen("output.txt", "wt", stdout);
 #endif

 char ch;
 scanf("%c", &ch);
 while (!feof(stdin))
 {
  ch=ch-'a';
  printf("%c", Change(ch)+'a');
  scanf("%c", &ch);
 }
 return 0;
}

char Change(char ch)
{
 static int s=5;
 int ch_res=ch-s;
 while (ch_res<0)
 {
  ch_res+=26;
 }
 s+=ch_res;
 return ch_res;
}
Re: WA 1404
Posted by Mishex 24 Feb 2008 14:28
This program output: "secret" on first test from task's condition, but take WA#1