/ Vijos / 讨论 / 分享 /

p1001

program p1001;

var

a:array[1..100,1..6] of longint;

b:array[1..100] of string[20];

s:string;

i,n,l,j,t,max,maxi:longint;

begin

readln(n);

t:=0;

for i:=1 to n do

begin

j:=0;

readln(s);

b[i]:=copy(s,1,20);

delete(b[i],pos(' ',b[i]),21);

delete(s,1,length(b[i])+1);

val(s,a,l);

if l0 then

val(copy(s,1,l-1),a);

delete(s,1,l);

val(s,a,l);

if l0 then

val(copy(s,1,l-1),a);

delete(s,1,l);

if s[1]='N' then a:=0

else a:=1;

if s[3]='N' then a:=0

else a:=1;

delete(s,1,4);

val(s,a,l);

if l0 then

val(copy(s,1,l-1),a);

if (a>80)and(a>0) then inc(j,8000);

if (a>85)and(a>80) then inc(j,4000);

if a>90 then inc(j,2000);

if (a>85)and(a>0) then inc(j,1000);

if (a>80)and(a>0) then inc(j,850);

inc(t,j);

if j>max then

begin

max:=j;

maxi:=i;

end;

end;

writeln(b[maxi]);

writeln(max);

writeln(t);

end.

这是我的程序,但我觉得太长了,请问能不能更短

7 条评论

  • @ 2009-11-10 17:19:06

    var

    n,i:integer;

    name:array[1..100]of string;

    a1,a2,a5:array[1..100]of integer;

    a3,a4:array[1..100]of char;

    max,p,total: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.

  • @ 2009-11-10 16:37:34

    都好短啊

  • @ 2009-11-10 15:38:05

    我的,你看看

    var i,j,k,n:integer;

    ave,mark,p,f,t,len:integer;

    ai:array[1..101] of string;

    bi:array[0..101] of longint;

    a,b,c,d,m,o,x:char;

    name:string;

    sum:longint;

    begin

    readln(n);

    f:=0;

    for i:=1 to n do

    begin

    t:=1;

    while t=1 do

    begin

    read(a);

    if a' ' then

    name:=name+a

    else

    t:=2;

    end;

    ai[i]:=name;

    read(ave,mark,m,c,o,b,x,p);

    if (ave>80)and(p>=1) then

    bi[i]:=bi[i]+8000;

    if (ave>85)and(mark>80) then

    bi[i]:=bi[i]+4000;

    if ave>90 then

    bi[i]:=bi[i]+2000;

    if (ave>85)and(b='Y') then

    bi[i]:=bi[i]+1000;

    if (mark>80)and(c='Y') then

    bi[i]:=bi[i]+850;

    if bi[i]>bi[f] then

    f:=i;

    sum:=sum+bi[i];

    len:=length(name);

    delete(name,1,len);

    end;

    writeln(ai[f]);

    writeln(bi[f]);

    writeln(sum);

    end.

  • @ 2009-11-10 15:28:09

    .................................................

  • @ 2009-11-10 15:02:49

    好短的程序啊//

    话说我当年打了将近二百行///

  • @ 2009-11-10 13:27:40

    ?·

    学C++的飘过!

  • @ 2009-11-10 13:20:21

    .

    挺短的了。。

  • 1