- 谁拿了最多奖学金
- 2009-10-29 23:27:25 @
代码如下:
var
a:array[1..100] of longint;
b,name:array[1..100]of string;
qm,py,lw,s,max,i,n,j,sum:longint;
xg,xb:string;
xuegan,xibu:boolean;
begin
readln(n);
sum:=0;
for i:=1 to n do
begin
s:=0;
readln(b[i]);
for j:=1 to length(b[i]) do
if b=' ' then break;
name[i]:=copy(b[i],1, j-1);
delete(b[i],1,j);
for j:=1 to length(b[i]) do
if b=' ' then break;
val(copy(b[i],1,j-1),qm);
delete(b[i],1,j);
for j:=1 to length(b[i]) do
if b=' ' then break;
val(copy(b[i],1,j-1),py);
delete(b[i],1,j);
for j:=1 to length(b[i]) do
if b=' ' then break;
xg:=copy(b[i],1,j-1);
delete(b[i],1,j);
for j:=1 to length(b[i]) do
if b=' ' then break;
xb:=copy(b[i],1,j-1);
delete(b[i],1,j);
val(b[i],lw);
delete(b[i],1,j);
if xg='Y' then xuegan:=true
else xuegan:=false;
if xb='Y' then xibu:=true
else xibu:=false;
if (qm>80) and(lw>0) then s:=s+8000;
if (qm>85)and (py>80) then s:=s+4000;
if (qm>90) then s:=s+2000;
if (qm>85) and xibu then s:=s+1000;
if (qm>80) and xuegan then s:=s+850;
a[i]:=s;
sum:=sum+a[i];
end;
max:=1;
for i:= 2 to n do
begin
if a[i]>a[max] then max:=i;
end;
writeln (name[max]);
writeln (a[max]);
writeln(sum);
end.
自己下了测试数据在机子上测,一直是最后的总和出问题,却不知道是哪里写错了。
求高手指点迷津啊~~~!!
2 条评论
-
蒙奇·D·路飞 LV 6 @ 2013-04-23 21:41:47
与二楼同感!
-
2009-11-03 23:44:35@
...自己看出来了。最后一行的判断期末和评议混了
…………无语
- 1