- 谁拿了最多奖学金
- 2009-09-09 13:34:51 @
var
a:array[1..100] of record
name:string;
school:longint;
class:longint;
ganbu:char;
xibu:char;
lunwen:longint;
end;
t:array[1..100] of longint;
n,i,s:longint;
ch:char;
max,x:longint;
begin
readln(n);
for i:=1 to n do
with a[i] do
begin
read(ch);
while ch' ' do
begin
name:=name+ch;
read(ch);
end;
read(school);
read(class);
read(ganbu,ganbu);
read(xibu,xibu);
readln(lunwen);
end;
for i:=1 to n do
with a[i] do
begin
if school > 80 then
if lunwen >= 1 then t[i]:=t[i]+8000;
if school >85 then
if class > 80 then t[i]:=t[i]+4000
else
if xibu='Y' then t[i]:=t[i]+1000;
if school > 90 then t[i]:=t[i]+2000;
if class > 80 then
if ganbu='Y' then t[i]:=t[i]+850;
end;
max:=-1;
for i:=1 to n do
if t[i] > max then
begin
max:=t[i];
s:=i;
end;
for i:=1 to n do
x:=x+t[i];
writeln(a.name);
writeln(max);
writeln(x);
end.
3 条评论
-
F.S LV 4 @ 2009-10-11 12:45:27
另外x没赋初值x:=0
-
2009-10-11 12:43:08@
不好意思没看清楚。。我估计如果过不掉 是超时。。
最好只用一次循环
(我第一次只过了一组。。后来把程序能省都省了,AC) -
2009-10-11 12:40:49@
读西部和干部的时候注意空格
- 1