- 谁拿了最多奖学金
- 2010-07-27 10:25:01 @
Program t1001;
Type
students=record
names:packed array [1..20] of char;
score1:0..100;
score2:0..100;
ganbu:boolean;
western:boolean;
lunwen:0..10;
sum:longint;
end;
student=record
names:packed array [1..20] of char;
sum:longint;
end;
Var
n,i,j,s:integer;
ch:char;
a:students;
b:student;
Begin
read(n);
for i:=1 to n do
with a do
begin
ganbu:=false;
western:=false;
lunwen:=0;
sum:=0;
read(ch);
j:=1;
while ch=' ' do
read(ch);
while ch' ' do
begin
names[j]:=ch;
j:=j+1;
read(ch);
end;
read(score1,score2);
read(ch);
while ch=' ' do
read(ch);
if ch='Y' then ganbu:=true;
read(ch);
while ch=' ' do
read(ch);
if ch='Y' then western:=true;
read(lunwen);
if score1>90 then sum:=sum+2000;
if (score1>85) and (score2>80) then sum:=sum+4000;
if (score1>85) and western then sum:=sum+1000;
if (score1>80) and (lunwen>0) then sum:=sum+8000;
if (score2>80) and ganbu then sum:=sum+850;
if i=1 then begin
b.names:=a.names;
b.sum:=a.sum;
end
else if b.sum
2 条评论
-
seekdreamer LV 7 @ 2012-10-02 21:02:43
...
VijosNT Mini 2.0.5.7 Special for Vijos
foo.pas(43,18) Warning: Variable "bestmoney" does not seem to be initialized
foo.pas(46,14) Warning: Variable "all" does not seem to be initialized├ 测试数据 01:答案正确... (0ms, 580KB)
├ 测试数据 02:答案正确... (0ms, 580KB)
├ 测试数据 03:答案正确... (0ms, 580KB)
├ 测试数据 04:答案正确... (0ms, 580KB)
├ 测试数据 05:答案正确... (0ms, 580KB)
├ 测试数据 06:答案正确... (0ms, 580KB)
├ 测试数据 07:答案正确... (0ms, 580KB)
├ 测试数据 08:答案正确... (0ms, 580KB)
├ 测试数据 09:答案正确... (0ms, 580KB)
├ 测试数据 10:答案正确... (0ms, 580KB)---|---|---|---|---|---|---|---|-
Accepted / 100 / 0ms / 580KB -
2010-07-27 15:53:46@
**。。 **
没怎么看你的程序
不过把 我的发给你比较一下
type ch=record
a:string;
b:integer;
end;
var s:string;
o,i,j,l,n,i1,j1,k:integer;
y:ch;
a:array[1..6] of string;
b:array[1..3] of integer;
x:longint;
beginreadln(n);
o:=0;
y.b:=0;
repeat
j1:=0;
inc(o);
fillchar(a,sizeof(a),0);
readln(s);
l:=length(s);
for i:=1 to l do
if (s=' ')or(i=1) then
for j:=i to l do
if (s[j+1]=' ')or(j=l)
then begin
inc(j1);
for i1:=i to j do
a[j1]:=a[j1]+s[i1];
break;
end;
val(a[2],b[1],j);
val(a[3],b[2],j);
val(a[6],b[3],j);
k:=0;
if (b[1]>80)and(b[3]>0) then inc(k,8000);
if (b[1]>85)and(b[2]>80) then inc(k,4000);
if (b[1]>90) then inc(k,2000);
if (b[1]>85)and(a[5]='Y') then inc(k,1000);
if (b[2]>80)and(a[4]='Y') then inc(k,850);
inc(x,k);
if k>y.b then begin
y.b:=k;
y.a:=a[1];
end;
until o=n;
writeln(y.a);
writeln(y.b);
writeln(x);end.
- 1