- 谁拿了最多奖学金
- 2017-08-13 11:24:57 @
帮我看看
var
i,j,n,p,t,ans:longint;
s:string;
a,d,e,z:array[1..100]of string;
b,c,f,g,h:array[1..100]of longint;
begin
readln(n);
for i:=1 to n do readln(z[i]);
for i:=1 to n do
for j:=1 to 5 do
begin
p:=pos(' ',z[i]);
case j of
1:a[i]:=copy(z[i],1,p-1);
2:begin s:=copy(z[i],1,p-1); val(s,b[i]); end;
3:begin s:=copy(z[i],1,p-1); val(s,c[i]); end;
4:d[i]:=copy(z[i],1,p-1);
5:e[i]:=copy(z[i],1,p-1);
end;
delete(z[i],1,p);
end;
for i:=1 to n do val(z[i],f[i]);
for i:=1 to n do h[i]:=i;
for i:=1 to n do
begin
if (b[i]>80)and(f[i]>=1) then g[i]:=g[i]+8000;
if (b[i]>85)and(c[i]>80) then g[i]:=g[i]+4000;
if b[i]>90 then g[i]:=g[i]+2000;
if (b[i]>85)and(e[i]='Y') then g[i]:=g[i]+1000;
if (c[i]>80)and(d[i]='Y') then g[i]:=g[i]+850;
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if g[i]<g[j] then
begin
t:=g[i];
g[i]:=g[j];
g[j]:=t;
s:=a[i];
a[i]:=a[j];
a[j]:=s;
end;
for i:=1 to n do
if g[i]=g[i+1] then inc(ans);
for i:=1 to ans do
for j:=i+1 to ans+1 do
if h[i]<h[j] then
begin
s:=a[i];
a[i]:=a[j];
a[j]:=s;
end;
for i:=1 to n do ans:=ans+g[i];
writeln(a[1]);
writeln(g[1]);
writeln(ans);
end.
0 条评论
目前还没有评论...