- 谁拿了最多奖学金
 - @ 2016-09-30 16:27:42
 
program ex8;
var na:array[1..100,1..21] of char;
    a,b,sch,f:array[1..100] of integer;
    c,d:array[1..100] of char;
    i,j,n,max,sum,asd,code:integer;
    ch:char;
    sr:string;
begin
  read(n);
  for i:=1 to n do
    begin
      sch[i]:=0;
      c[i]:='1';
    end;
  sum:=0;
  max:=0;
  for i:=1 to n do
    for j:=1 to 21 do
      begin
         read(na[i,j]);
         if (na[i,j]=' ') then
                            begin
                              read(a[i],b[i]);
                              read(sr);
                              c[i]:=sr[2];
                              d[i]:=sr[4];
                              delete(sr,1,5);
                              val(sr,f[i],code);
                              break;
                            end;
      end;
  for i:=1 to n do
    begin
      if (a[i]>80) and (f[i]>=1) then sch[i]:=sch[i]+8000;
      if (a[i]>85) and (b[i]>=80) then sch[i]:=sch[i]+4000;
      if a[i]>90 then sch[i]:=sch[i]+2000;
      if (a[i]>85) and (d[i]='Y') then sch[i]:=sch[i]+1000;
      if (b[i]>80) and (c[i]='Y') then sch[i]:=sch[i]+850;
    end;
  for i:=1 to n do
    begin
      sum:=sum+sch[i];
      if sch[i]>max then
                      begin
                        max:=sch[i];
                        asd:=i;
                      end;
    end;
  for i:=1 to 21 do
    if na[asd,i]<>' '  then write(na[asd,i])
                       else break;
  writeln;
  writeln(sch[asd]);
  writeln(sum);
end.