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

Please, HELP! I can't understand why I have got WA (1044)!
Posted by Alexandr Makarov 17 Apr 2002 16:53
My program solves all my tests, but it always gets WA from Online
Judge, WHY?
Here is my program:

program tim1044;
var main,nd2,n,i,sum,q: integer;
    otv: longint;
    a: array [0..36] of longint;
begin
readln(n);
nd2:=n div 2;
repeat
  sum:=0;
  q:=main;
  for i:=1 to nd2 do
  begin
    sum:=sum+(q mod 10);
    q:=q div 10;
  end;
  if q>0 then break;
  a[sum]:=a[sum]+1;
  main:=main+1;
until false;
for i:=0 to 9*nd2 do otv:=otv+a[i]*a[i];
if n mod 2=1 then otv:=otv*10;
writeln(otv);
end.

Thank you!