- 谁拿了最多奖学金
- 2009-10-04 21:41:41 @
var
n,m,jj,jjmax,jjzs,cj,py,lw,i:longint;
xg,xb,a:char;
xm,jjxm:string;
begin
readln (n);
m:=0;
jj:=0;
jjmax:=0;
jjzs:=0;
xm:=' ';
for i:=1 to n do
begin
repeat
read(a);
if a' ' then xm:=xm+a;
until a=' ';
read(cj);
read(py);
read(xg);
read(xb);
read (lw);
if (cj>80)and(lw>1) then jj:=jj+8000;
if (cj>85)and(py>80) then jj:=jj+4000;
if cj>90 then jj:=jj+2000;
if (cj>85)and(xb='Y') then jj:=jj+1000;
if (py>80)and(xg='Y') then jj:=jj+850;
jjzs:=jjzs+jj;
if jj>jjmax then begin jjmax:=jj; jjxm:=xm; end;
jj:=0;
end;
writeln(jjxm);
writeln(jjmax);
writeln(jjzs);
end.
我是菜鸟级的啊,麻烦帮忙看看
2 条评论
-
shenzhi518 LV 4 @ 2009-10-07 20:14:00
懂了。。谢了
明白了。。问题就卡在字符串读进去这了,,郁闷
-
2009-10-04 21:46:36@
懂不?
const maxn=100;
var n,i,j,k,a1,a2,a5,max,result,maxresult:integer;
sum:longint;
st:string;
name:array[1..maxn] of string[20];
temp:array[1..5] of string[3];
begin
readln(n);
max:=1;
maxresult:=0;
sum:=0;
for i:=1 to n do
begin
readln(st);
result:=0;
k:=pos(' ',st);
name[i]:=copy(st,1,k-1);
delete(st,1,k);
for j:=1 to 4 do
begin
k:=pos(' ',st);
temp[j]:=copy(st,1,k-1);
delete(st,1,k);
end;
temp[5]:=st;
val(temp[1],a1);
val(temp[2],a2);
val(temp[5],a5);
if (a1>80) and (a5>=1) then result:=result+8000;
if (a1>85) and (a2>80) then result:=result+4000;
if a1>90 then result:=result+2000;
if (a1>85) and (temp[4]='Y') then result:=result+1000;
if (a2>80) and (temp[3]='Y') then result:=result+850;
if maxresult
- 1