比赛 20101119 评测结果 AAAWAAATAA
题目名称 奥运会 最终得分 80
用户昵称 Achilles 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-19 09:35:35
显示代码纯文本
program olympic;
var
  g,s,b:array[1..15]of longint;
  n,i,j,r2,max,min,maxx,minn,fg,fs,l,r,temp,ans,ans1,ans2,ans3:longint;
  xxx:real;
begin
  assign(input,'olympic.in');
  assign(output,'olympic.out');
  reset(input);
  rewrite(output);
  read(n);
  for i:=1 to n do
    read(g[i],s[i],b[i]);
  ans:=0;
  for fg:=1 to 1000 do
    for fs:=1 to fg do
    begin
      max:=1001;
      min:=-1;
      r2:=0;
      for j:=2 to n do
      begin
        l:=fg*(g[1]-g[j])+fs*(s[1]-s[j]);
        r:=b[j]-b[1];
        if not((l<0)and(r>=0)) then begin
          if (l>=0)and(r=0) then begin
            r2:=r2+1;
            end
            else begin
            xxx:=l/r;
            if r>0 then begin
              if xxx>=1 then begin
                r2:=r2+1;
                temp:=trunc(xxx);
                maxx:=max;
                minn:=min;
                if temp<max then max:=temp;
                if (min>max)or(min>fs) then begin
                  r2:=r2-1;
                  max:=maxx;
                  min:=minn;
                end;
              end;
            end
            else begin
              if xxx<=1000 then begin
                r2:=r2+1;
                temp:=trunc(xxx);
                if xxx-trunc(xxx)>0 then
                  temp:=temp+1;
                maxx:=max;minn:=min;
                if temp>min then min:=temp;
                if (min>max)or(min>fs) then begin
                  r2:=r2-1;
                  max:=maxx;
                  min:=minn;
                end;
              end;
            end;
          end;
        end;
      end;
      if (r2>ans)and((min=-1)or((min>-1)and(min<=fs)))and((min<=max)or(max=1001)) then begin
        ans:=r2;
        ans1:=fg;
        ans2:=fs;
        if min>-1 then ans3:=min else ans3:=1;
        if r2=n-1 then begin
          if (ans1=0)or(ans2=0)or(ans3=0) then
            writeln('1 1 1')
          else
            writeln(ans1,' ',ans2,' ',ans3);
          close(input);
          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(input);
  close(output);
end.