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 1200. Horns and Hoofs

Why I have WA. plz help me
Posted by Denol 30 Nov 2007 14:12
var a,b:extended;
    x,y,k:longint;
    a1,b2,max:extended;
begin
 readln(a,b);
 readln(k);
 for x:=1 to k do begin
  y:=k-x;
  if (y*a)+(x*b)-sqr(y)-sqr(x)>max
  then begin max:=(y*a)+(x*b)-sqr(y)-sqr(x);
             a1:=y;
             b2:=x;
  end;
 end;
 writeln(max:0:2);
 writeln(a1:0:0,' ',b2:0:0);
 readln
end.
Re: Why I have WA. plz help me
Posted by Sean38 2 Dec 2007 06:11
(x+y) can be smaller than K...