level 10
沉默太久水瓶
楼主
程序:
type
shuju=record
name:string;
pingjun:integer;
pingyi:integer;
ganbu:char;
xibu:char;
lunwen:integer;
sum:longint;
end;
var
a:array[1..100] of shuju;
i,j,t,n,ans:integer;
s:string;
begin
readln(n);
for i:=1 to n do
begin
readln(s);
t:=1;
for j:=1 to length(s) do
begin
if t=6 then begin
if s[j]<>' ' then a[i].lunwen:=ord(s[j])-48;
if s[j]=' ' then inc(t);
end;
if t=5 then begin
if s[j]<>' ' then a[i].xibu:=s[j];
if s[j]=' ' then inc(t);
end;
if t=4 then begin
if s[j]<>' ' then a[i].ganbu:=s[j];
if s[j]=' ' then inc(t);
end;
if t=3 then begin
if s[j]<>' ' then a[i].pingyi:=a[i].pingyi*10+ord(s[j])-48;
if s[j]=' ' then inc(t);
end;
if t=2 then begin
if s[j]<>' ' then a[i].pingjun:=a[i].pingjun*10+ord(s[j])-48;
if s[j]=' ' then inc(t);
end;
if t=1 then begin
if s[j]<>' ' then a[i].name:=a[i].name+s[j];
if s[j]=' ' then inc(t);
end;
end;
end;
t:=1;
ans:=0;
for i:=1 to n do
begin
if (a[i].pingjun>80) and (a[i].lunwen>=1) then inc(a[i].sum,8000);
if (a[i].pingjun>85) and (a[i].pingyi>80) then inc(a[i].sum,4000);
if a[i].pingjun>90 then inc(a[i].sum,2000);
if (a[i].pingjun>85) and (a[i].xibu='Y') then inc(a[i].sum,1000);
if (a[i].pingyi>80) and (a[i].ganbu='Y') then inc(a[i].sum,850);
end;
ans:=0;
t:=1;
for i:=1 to n do
if a[t].sum<a[i].sum then t:=i;
writeln(a[t].name);
writeln(a[t].sum);
for i:=1 to n do
ans:=ans+a[i].sum;
write(ans);
end.
2014年06月20日 04点06分
1
type
shuju=record
name:string;
pingjun:integer;
pingyi:integer;
ganbu:char;
xibu:char;
lunwen:integer;
sum:longint;
end;
var
a:array[1..100] of shuju;
i,j,t,n,ans:integer;
s:string;
begin
readln(n);
for i:=1 to n do
begin
readln(s);
t:=1;
for j:=1 to length(s) do
begin
if t=6 then begin
if s[j]<>' ' then a[i].lunwen:=ord(s[j])-48;
if s[j]=' ' then inc(t);
end;
if t=5 then begin
if s[j]<>' ' then a[i].xibu:=s[j];
if s[j]=' ' then inc(t);
end;
if t=4 then begin
if s[j]<>' ' then a[i].ganbu:=s[j];
if s[j]=' ' then inc(t);
end;
if t=3 then begin
if s[j]<>' ' then a[i].pingyi:=a[i].pingyi*10+ord(s[j])-48;
if s[j]=' ' then inc(t);
end;
if t=2 then begin
if s[j]<>' ' then a[i].pingjun:=a[i].pingjun*10+ord(s[j])-48;
if s[j]=' ' then inc(t);
end;
if t=1 then begin
if s[j]<>' ' then a[i].name:=a[i].name+s[j];
if s[j]=' ' then inc(t);
end;
end;
end;
t:=1;
ans:=0;
for i:=1 to n do
begin
if (a[i].pingjun>80) and (a[i].lunwen>=1) then inc(a[i].sum,8000);
if (a[i].pingjun>85) and (a[i].pingyi>80) then inc(a[i].sum,4000);
if a[i].pingjun>90 then inc(a[i].sum,2000);
if (a[i].pingjun>85) and (a[i].xibu='Y') then inc(a[i].sum,1000);
if (a[i].pingyi>80) and (a[i].ganbu='Y') then inc(a[i].sum,850);
end;
ans:=0;
t:=1;
for i:=1 to n do
if a[t].sum<a[i].sum then t:=i;
writeln(a[t].name);
writeln(a[t].sum);
for i:=1 to n do
ans:=ans+a[i].sum;
write(ans);
end.