比赛 20101119 评测结果 C
题目名称 奥运会 最终得分 0
用户昵称 maxiem 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-19 11:11:43
显示代码纯文本
program RP++;
{This program is used for GETTING RP++.}
var
    n,i,j,r,pg,ps,left,right,temp,max,min,maxx,minn,ans,ans1,ans2,ans3:longint;
    g,s,b:array [1..15] of longint;
    lbr:real;
begin
    assign(input,'olympic.in');
	reset(input);
    read(n);
    for i:=1 to n do read(g[i],s[i],b[i]);
	close (input);
    assign(output,'olympic.out');
	rewrite(output);
    ans:=0;
    for pg:=1 to 1000 do for ps:=1 to pg do begin
        max:=1001;
        min:=-1;
        r:=0;
        for j:=n downto 2 do begin
            left:=pg*(g[1]-g[j])+ps*(s[1]-s[j]);
            right:=b[j]-b[1];
            if not((left<0) and (right>=0)) then begin
                if (left>=0) and (right=0) then inc(r) else begin
                    lbr:=left/right;
                    if right>0 then begin
                        if lbr>=1 then begin
                            inc(r);
                            temp:=trunc(lbr);
                            maxx:=max;minn:=min;
                            if temp<max then max:=temp;
                            if (min>max) or (min>ps) then begin
                                r:=r-1;
                                max:=maxx;
                                min:=minn;
                            end;
                        end;
					end
					else begin
                        if lbr<=1000 then begin
                            inc(r);
                            temp:=trunc(lbr);
                            if lbr-trunc(lbr)>0 then
                            inc(temp);maxx:=max;minn:=min;
                            if temp>min then min:=temp;
                            if (min>max) or (min>ps) then begin
                                r:=r-1;
                                max:=maxx;
                                min:=minn;
                            end;
					    end;
                    end;
			    end;
			end;
        end;
        if (r>ans) and ((min=-1) or ((min>-1) and (min<=ps))) and ((min<=max) or (max=1001)) then begin
            ans:=r;
            ans1:=pg;
            ans2:=ps;
            if min>-1 then ans3:=min else ans3:=1;
            if r=n-1 then begin
                if (ans1=0) or (ans2=0) or (ans3=0) then writeln('1 1 1') else writeln(ans1,' ',ans2,' ',ans3);
				close(output);
                halt;
            end;
        end;
    end;
    if (ans1=0) or (ans2=0) or (ans3=0) then writeln('1 1 1') else writeln(ans1,' ',ans2,' ',ans3);
	close(output);
end.