| 记录编号 | 22525 | 评测结果 | AAAWWWWWWW | 
    
        | 题目名称 | 517.奥运会 | 最终得分 | 30 | 
    
        | 用户昵称 |  苏轼 | 是否通过 | 未通过 | 
    
        | 代码语言 | Pascal | 运行时间 | 8.359 s | 
    
        | 提交时间 | 2010-11-19 15:27:38 | 内存使用 | 0.30 MiB | 
    
    
    
    		显示代码纯文本
		
		program olympic(input,output);
label
  1;
const
  tm:array[1..15]of integer=(800,600,520,500,480,450,420,400,390,370,350,340,330,320,310);
var
  n,i,j,pg,ps,pb,tmp,count,min,aag,aas,aab:longint;
  g,s,b:array[1..16]of longint;
  gx,sx,bx:array[1..16,1..1000]of longint;
begin
  assign(input,'olympic.in');
  reset(input);
  assign(output,'olympic.out');
  rewrite(output);
  readln(n);
  for i:=1 to n do
    readln(g[i],s[i],b[i]);
  for i:=1 to n do
    for j:=1 to 1000 do
    begin
      gx[i,j]:=g[i]*j;
      sx[i,j]:=s[i]*j;
      bx[i,j]:=b[i]*j;
    end;
  min:=maxlongint;
  for pg:=1 to tm[n] do
    for ps:=1 to pg do
      for pb:=1 to ps do
      begin
        tmp:=gx[1,pg]+sx[1,ps]+bx[1,pb];
        count:=0;
        for i:=2 to n do
          if gx[i,pg]+sx[i,ps]+bx[i,pb]>tmp then
            inc(count);
        if count<min then
        begin
          aag:=pg;
          aas:=ps;
          aab:=pb;
          min:=count;
          if count=0 then
            goto 1;
        end;
      end;
1:
  writeln(aag,' ',aas,' ',aab);
  close(input);
  close(output);
end.