某校的惯例是在每学期的期末考试之后发放奖学金。发放的奖学金共有五种,获取的条件各自不同:1) 院士奖学金,每人8000元,期末平均成绩高于80分(>80),并且在本学期内发表1篇或1篇以上论文的学生均可获得;2) 五四奖学金,每人4000元,期末平均成绩高于85分(>85),并且班级评议成绩高于80分(>80)的学生均可获得;3) 成绩优秀奖,每人2000元,期末平均成绩高于90分(>90)的学生均可获得;4) 西部奖学金,每人1000元,期末平均成绩高于85分(>85)的西部省份学生均可获得;5) 班级贡献奖,每人850元,班级评议成绩高于80分(>80)的学生干部均可获得;只要符合条件就可以得奖,每项奖学金的获奖人数没有限制,每名学生也可以同时获得多项奖学金。例如姚林的期末平均成绩是87分,班级评议成绩82分,同时他还是一位学生干部,那么他可以同时获得五四奖学金和班级贡献奖,奖金总数是4850元。现在给出若干学生的相关数据,请计算哪些同学获得的奖金总数最高(假设总有同学能满足获得奖学金的条件)。
分析:水题,直接暴力判断
var
name:array[1..100] of string;
a1,a2,a5:array[1..100] of longint;
a3,a4:array[1..100] of char;
n,i,max,total,p:longint;
maxname:string;
ch:char;
begin
readln(n);
for i:=1 to n do
begin
read(ch);
while ch<>' ' do
begin
name[i]:=name[i]+ch;
read(ch);
end;
readln(a1[i],a2[i],ch,a3[i],ch,a4[i],ch,a5[i]);
end;
for i:=1 to n do
begin
p:=0;
if (a1[i]>80) and (a5[i]>=1) then inc(p,8000);
if (a1[i]>85) and (a2[i]>80) then inc(p,4000);
if (a1[i]>90) then inc(p,2000);
if (a1[i]>85) and (a4[i]='Y') then inc(p,1000);
if (a2[i]>80) and (a3[i]='Y') then inc(p,850);
if p>max
then begin
max:=p;
maxname:=name[i];
end;
inc(total,p);
end;
writeln(maxname);
writeln(max);
writeln(total);
end.
转载请注明原文地址: https://ju.6miu.com/read-662322.html