大神求救啊,为何总是超时

program P1001;
const m=100;
type Input=record
nam:string[20];
average:integer;
assess:integer;
cadre:char;
west:char;
paper:integer;
money:integer;
end;
var a:array[1..m] of Input;
n,i,max,k,l:integer;
c:char;
begin
readln(n);
for i:=1 to n do
begin
k:=0;
with a[i] do
begin
while c<>' ' do
nam:=nam+c;
read(average,assess,cadre,west,paper);
if average>80 then
begin
if paper>0 then k:=k+8000;
if average>85 then
begin
if assess>80 then k:=k+4000;
if (west='Y') then k:=k+1000;
end;
if average>90 then k:=k+2000;
end;
if (assess>80) and (cadre='Y') then k:=k+850;
money:=k;
end;
if max<k then max:=k;
l:=l+k;
end;
for i:= 1 to n do
if a[i].money=max then with a[i] do
begin
writeln(nam);
writeln(money);
break;
end;
writeln(l);
end.

1 条评论

  • @ 2016-12-03 14:10:04

    type node=record
    na:string;
    fi:longint;
    cl:longint;
    sl:string;
    ws:string;
    ar:longint;
    end;
    var
    b:array[1..101]of string;
    a:array[1..101]of node;
    k,f:array[1..101]of longint;
    n,m,l,i,j,t:longint;
    procedure readword;
    begin
    read(n);
    readln;
    for i:=1 to n do
    begin
    read(b[i]);
    readln;
    end;
    for i:=1 to n do
    begin
    for m:=1 to length(b[i])do
    begin
    if b[i][m]=' ' then
    begin
    a[i].na:=copy(b[i],1,m-1);
    delete(b[i],1,m);
    break;
    end;
    end;
    for m:=1 to length(b[i])do
    begin
    if b[i][m]=' ' then
    begin
    val(copy(b[i],1,m-1),a[i].fi);
    delete(b[i],1,m);
    break;
    end;
    end;
    for m:=1 to length(b[i])do
    begin
    if b[i][m]=' ' then
    begin
    val(copy(b[i],1,m-1),a[i].cl);
    delete(b[i],1,m);
    break;
    end;
    end;
    for m:=1 to length(b[i])do
    begin
    if b[i][m]=' ' then
    begin
    a[i].sl:=copy(b[i],1,m-1);
    delete(b[i],1,m);
    break;
    end;
    end;
    for m:=1 to length(b[i])do
    begin
    if b[i][m]=' ' then
    begin
    a[i].ws:=copy(b[i],1,m-1);
    delete(b[i],1,m);
    break;
    end;
    end;
    val(b[i][1],a[i].ar);
    end;
    end;
    begin
    readword;
    for i:=1 to n do
    begin
    if(a[i].fi>80)and(a[i].ar>=1)then k[i]:=k[i]+8000;
    if(a[i].fi>85)and(a[i].cl>80)then k[i]:=k[i]+4000;
    if a[i].fi>90 then k[i]:=k[i]+2000;
    if(a[i].fi>85)and(a[i].ws='Y')then k[i]:=k[i]+1000;
    if(a[i].cl>80)and(a[i].sl='Y')then k[i]:=k[i]+850;
    end;
    for i:=1 to n do
    if j<k[i] then j:=k[i];
    for i:=1 to n do
    if j=k[i] then
    begin
    write(a[i].na);
    break;
    end;
    writeln;
    write(j);
    writeln;
    j:=0;
    for i:=1 to n do
    j:=j+k[i];
    write(j);
    end.

  • 1

信息

ID
1001
难度
5
分类
模拟 点击显示
标签
递交数
39307
已通过
12806
通过率
33%
被复制
132
上传者