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 1066. Garland

Why I got WA #1.....I test many times....
Posted by weep 14 Mar 2005 19:02
This is my code:

{$N+}
program u1066;

 var
   n,i:longint;
   a1,an,tmp:extended;

begin
  readln(n,a1);
  for i:=3 to n do
  begin
    tmp:=(a1-i+1)*(i-2)/(i-1);
    if tmp>an then an:=tmp;
  end;
  an:=(n-1)*an+(n-1)*(n-2)-(n-2)*a1;
  if an<0 then an:=0;
  writeln(an:0:2);
end.

I tried these:
100 100 =>7921.00
10 11 =>32.00
123 456 =>10128.86
111 111 =>9891.00
8 15 =>9.75
5 10 =>0.67
70 50 =>3835.14
1000 1=>996004.00
Your code is AC! maybe you was wrong when inputs number of problem? (-)
Posted by Heaven 15 Mar 2005 02:26