比赛 20101119 评测结果 AAAWWWWWWW
题目名称 奥运会 最终得分 30
用户昵称 ZhouZn1 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-19 09:30:11
显示代码纯文本
program zzn;
type
        rec=record
        g,s,b:longint;
        end;
var
        i,j,pg,ps,pb,n,num,max:longint;
        data:array[1..15]of rec;
        ans:array[1..3]of longint;
        tot:array[1..15]of longint;
procedure init;
begin
        assign(input,'olympic.in');
        reset(input);
        assign(output,'olympic.out');
        rewrite(output);
        readln(n);
        for i:=1 to n do with  data[i]do
        begin
            readln(g,s,b);
        end;
end;
procedure closef;
begin
        close(input);
        close(output);
end;
procedure main;
begin
        max:=maxlongint;
        for pg:=1 to 100 do
         for ps:=1 to pg do
          for pb:=1 to ps  do
           begin
              num:=0;
              for i:=1 to n do tot[i]:=data[i].g*pg+data[i].s*ps+data[i].b*pb;
              for i:=2 to n do if tot[i]>tot[1] then inc(num);
              if num=0 then
               begin
                   writeln(pg,' ',ps,' ',pb);
                   exit;
               end;
              if num<max then
               begin
                   max:=num;
                   ans[1]:=pg;
                   ans[2]:=ps;
                   ans[3]:=pb;
               end;
           end;
        writeln(ans[1],' ',ans[2],' ',ans[3]);
end;
begin
        init;
        main;
        closef;
end.