状态题目:奖学金
题目编号:126-奖学金 [查看该题]
状态: Unaccepted
测评机: Xeond[6]
得分: 80分
提交日期: 2008-8-3 13:22:00
有效耗时: 578毫秒
测试结果1: 通过本测试点|有效耗时219:ms
测试结果2: 通过本测试点|有效耗时47:ms
测试结果3: 通过本测试点|有效耗时47:ms
测试结果4: 通过本测试点|有效耗时63:ms
测试结果5: 测试结果错误.错误结果为:66 276
101 270
88 270
19 270
93 267
正确结果应为:66 276
88 270
19 270
101 270
93 267
测试结果6: 通过本测试点|有效耗时47:ms
测试结果7: 测试结果错误.错误结果为:10 292
130 292
45 292
143 276
171 276
正确结果应为:10 292
45 292
130 292
171 276
143 276
测试结果8: 通过本测试点|有效耗时46:ms
测试结果9: 通过本测试点|有效耗时47:ms
测试结果10: 通过本测试点|有效耗时62:ms
提交代码:
var
n,i,j,t:integer;
a,b,c:array[1..300]of byte;
x,z:array[1..300]of integer;
begin
read(n);
for i:=1 to n do
begin
readln(a[i],b[i],c[i]);
x[i]:=a[i]+b[i]+c[i];
z[i]:=i;end;
for i:=1 to n do
for j:=1 to n-i do
if x[j]<x[j+1]
then begin t:=x[j+1]; x[j+1]:=x[j]; x[j]:=t; t:=z[j+1]; z[j+1]:=z[j]; z[j]:=t;end
else if x[j]=x[j+1]
then if a[j]<a[j+1]
then begin t:=x[j+1]; x[j+1]:=x[j]; x[j]:=t; t:=z[j+1]; z[j+1]:=z[j]; z[j]:=t; end
else if (a[j]=a[j+1])and(z[j]>z[j+1])
then begin t:=x[j+1]; x[j+1]:=x[j]; x[j]:=t; t:=z[j+1]; z[j+1]:=z[j]; z[j]:=t; end;
for i:=1 to 5 do
writeln(z[i],’ ’,x[i]);
end.