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!

Maqsud Erjonov Why WA #4? [5] // Problem 1404. Easy to Hack! 14 Sep 2009 19:01
var sh,de:string;
    a:array[1..100]of integer;
    i,n:Integer;
begin
readln(sh);
n:=length(sh);
for i:=1 to n do a[i]:=ord(sh[i])-97;
for i:=2 to n do
  if a[i]<a[i-1] then a[i]:=a[i]+((a[i-1]-a[i])div 26 + 1)*26;
for i:=n downto 2 do a[i]:=a[i]-a[i-1];
a[1]:=a[1]-5;
de:='';
for i:=1 to n do de:=de+chr(97+a[i] mod 26);
writeln(de);
end.

i didn't understand where is my mistake
Sergey Lazarev (MSU Tashkent) Re: Why WA #4? [3] // Problem 1404. Easy to Hack! 14 Sep 2009 20:42
a[1] can be less than 5.
Maqsud Erjonov Re: Why WA #4? // Problem 1404. Easy to Hack! 15 Sep 2009 17:43
Thank you
Le Viet Thanh Long Re: Why WA #4? // Problem 1404. Easy to Hack! 5 Aug 2011 10:26

Edited by author 05.08.2011 16:43

Edited by author 05.08.2011 16:43
BillSu Re: Why WA #4? // Problem 1404. Easy to Hack! 27 Apr 2014 18:03
You are great! I got the same mistake.
Adhambek Re: Why WA #4? // Problem 1404. Easy to Hack! 25 May 2013 01:19
if you problem input is "adham" . what is output?
output is "vdetm" . You should know if the first letter is "a" or "b" or "c" or "d" or "f"
(char)("a" + 26) is correct way!