- 谁拿了最多奖学金
- 2012-10-15 18:49:34 @
type node=record
num:integer;
nam:string;
fina:integer;
clas:integer;
gan:boolean;
west:boolean;
lun:integer;
sch:longint;
end;
var
n,i:integer;
a:array[0..100]of node;
sum:longint;
procedure inpu;
var s,tt:string;x,t,l,j:integer;
begin
for i:=1 to n do
begin
readln(s); x:=0;
a[i].num:=i;
for j:=1 to length(s) do
case s[j]of
'A'..'Z','a'..'z':if x=0 then a[i].nam:=a[i].nam+s[j]
else if x=3 then if s[j]='Y' then a[i].gan:=true else a[i].gan:=false
else if x=4 then if s[j]='Y' then a[i].west:=true else a[i].west:=false;
' ':inc(x);
'0'..'9':if x=1 then a[i].fina:=a[i].fina*10+ord(s[j])-48
else if x=2 then a[i].clas:=a[i].clas*10+ord(s[j])-48
else if x=5 then a[i].lun:=a[i].lun*10+ord(s[j])-48;
end;
end;
end;
procedure qsort(l,r:integer);
var i,j:integer;t,x:node;
begin
i:=l;j:=r; x:=a[random(r-l)+l];
repeat
while (a[j].schx.num)) do dec(j);
while (a[i].sch>x.sch)or((a[i].sch=x.sch)and(a[i].num>x.num)) do inc(i);
if ij;
if i85 then a[i].sch:=a[i].sch+4000;
end;
if (a[i].fina>85 ) and(a[i].west) then a[i].sch:=a[i].sch+1000;
if a[i].fina>90 then a[i].sch:=a[i].sch+2000;
if (a[i].fina>80)and(a[i].lun>=1) then a[i].sch:=a[i].sch+8000;
end;
qsort(1,n);
writeln(a[1].nam);
writeln(a[1].sch);
sum:=0;
for i:=1 to n do
sum:=sum+a[i].sch;
write(sum);
//close(input);
end.