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

I submited my program n times but always got WA, HELP!!!
Posted by turkeys 25 Mar 2002 17:23
{This is my program}
program URAL1200;

var
        a,b,xx,max:real;
        c,k,x,y:longint;
        bestx,besty:longint;

begin
        read(a,b,k);
        max:=0;
        bestx:=0;
        besty:=0;
        for c:=1 to k do begin
                xx:=(2*c+a-b)/4;
                if xx<0 then xx:=0;
                if xx>c then xx:=c;
                x:=round(xx-0.001);
                y:=c-x;
                if a*x+b*y-x*x-y*y>max then begin
                        max:=a*x+b*y-x*x-y*y;
                        bestx:=x;
                        besty:=y;
                end;
        end;
        writeln(max:0:2);
        writeln(bestx,' ',besty);
end.