就像解题报告中说的超简单,但还是出了许多小毛病,如刚开始将sum同avi,paper等定义在一起,而我为了省空间将它们限制在0..100,故算出来的sum错误无疑了;用字符读入数据时忘了空格……最后在比较时本想输出sum同最先出现的人却费事的用downto,结果没用‘<=’反画蛇添足了……唉……太粗心了……

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
program scholar;
type node=record
name:string[20];
avi,ping,paper:0..100;
bu,west:boolean;
sum:integer;
end;
var stu:array [0..100] of node;
i,n,max:integer;
sumup:longint;
c:char;
begin
assign(input,'scholar1.in');reset(input);
assign(output,'');rewrite(output);
readln(n);
for i:=0 to 100 do
with stu[i] do begin
name:='';
avi:=0;ping:=0;paper:=0;sum:=0;
bu:=false;west:=false;
end;
for i:=1 to n do
with stu[i] do begin
read(c);
while c<>' ' do begin name:=name+c;read(c);end;
read(avi);read(ping);
read(c);
read(c);if c='Y'then bu:=true else bu:=false;
read(c);
read(c);if c='Y'then west:=true else west:=false;
readln(paper);
if (avi>80)and(paper>0)then inc(sum,8000);
if (avi>85)and(ping>80) then inc(sum,4000);
if avi>90 then inc(sum,2000);
if (avi>85)and west then inc(sum,1000);
if (ping>80)and bu then inc(sum,850);
end;
sumup:=0;max:=0;
for i:=1 to n do begin
sumup:=sumup+stu[i].sum;
if max<stu[i].sum then begin
max:=stu[i].sum;stu[0]:=stu[i];
end;
end;
writeln(stu[0].name);writeln(stu[0].sum);writeln(sumup);
close(input);close(output);
end.

欢迎关注我的公众号『日技』