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!

Can any1 help what is wrong here???
Posted by Swifty 12 Mar 2009 14:02
var s:string;
    s1:array [1..100] of char;
    a,b:array [1..100] of integer;
    i,j,n:integer;
begin
  readln(s);
  n:=length(s);
  for i:=1 to n do
    a[i]:=ord(s[i])-97;
  for i:=n downto 2 do         {24+x-26 = 17}
    begin
      b[i]:=(a[i]+26-a[i-1])mod 26;
      s1[i]:=chr(b[i]+97);
    end;
  s1[1]:=chr(((a[1]-5)mod 26)+97);
  for i:=1 to n do
    write(s1[i]);
  readln;
end.
WA on 4th test!!!
Re: Can any1 help what is wrong here???
Posted by Swifty 12 Mar 2009 14:11
lol got AC now....