noip2005-奖学金 2008.10.17
program scholar;
const fin='scholar.in';fout='scholar.out';
var f1,f2:text;
n,p,max,i,x1,x2,k,t,code,tot:longint;
y1,y2,x,na,names:string;
begin
assign(f1,fin);reset(f1);
assign(f2,fout);rewrite(f2);
readln(f1,n);max:=0;tot:=0;
for i:=1 to n do
begin
readln(f1,x);p:=0;
t:=pos(' ',x);
na:=copy(x,1,t-1);
x:=copy(x,t+1,length(x)-t);
t:=pos(' ',x);
val(copy(x,1,t-1),x1,code);
x:=copy(x,t+1,length(x)-t);
t:=pos(' ',x);
val(copy(x,1,t-1),x2,code);
x:=copy(x,t+1,length(x)-t);
y1:=copy(x,1,1);y2:=copy(x,3,1);
x:=copy(x,4,length(x)-3);
val(x,k,code);
if (x1>80)and(k>=1) then inc(p,8000);
if (x1>85)and(x2>80) then inc(p,4000);
if (x1>90) then inc(p,2000);
if(x1>85)and(y2='Y')then inc(p,1000);
if (x2>80)and(y1='Y') then inc(p,850);
if p>max then begin max:=p;names:=na;end;
inc(tot,p);
end;
writeln(f2,names);
writeln(f2,max);
writeln(f2,tot);
close(f1);
close(f2);
end.