- 谁拿了最多奖学金
- 2017-03-11 15:01:33 @
Var
n,i,j,l,qm,by,max,num,cl,zs,lw,jl:longint;
mz,ming:array[1..20]of char;
s:string;
xb,bg,k:char;
Begin
readln(n);
max:=0;
for i:=1 to n do
begin
readln(s);
qm:=0; by:=0; lw:=0; jl:=0; l:=0; num:=0;
for j:=1 to length(s) do
if s[j]=' ' then
begin
jl:=j+1;
l:=j-1;
break;
end
else
mz[j]:=s[j];
for j:=jl to length(s) do
if s[j]=' ' then
begin
jl:=j+1;
break;
end
else
qm:=qm*10+ord(s[j])-48;
for j:=jl to length(s) do
if s[j]=' ' then
begin
jl:=j+1;
break;
end
else
by:=by*10+ord(s[j])-48;
bg:=s[jl];
jl:=jl+2;
xb:=s[jl];
jl:=jl+2;
for j:=jl to length(s) do
lw:=lw*10+ord(s[j])-48;
if (qm>80) and (lw>=1) then
num:=num+8000;
if (qm>85) and (by>80) then
num:=num+4000;
if qm>90 then
num:=num+2000;
if (qm>85) and (xb='Y') then
num:=num+1000;
if (by>80) and (bg='Y') then
num:=num+850;
if max<num then
begin
max:=num;
for j:=1 to 20 do
ming[j]:=' ';
for j:=1 to l do
ming[j]:=mz[j];
cl:=l;
end;
zs:=zs+num;
end;
for i:=1 to l do
write(ming[i]);
writeln;
writeln(max);
writeln(zs);
readln;
End.
2 条评论
-
Fop_zz LV 10 @ 2017-05-13 18:46:54
pas的尴尬。。
转C保平安#include<iostream> #include<string> #include<cstdio> using namespace std; int main(){ char n[105][25],p1[5],p2[5]; int nn,s1,s2,lw,m,ma=-1,poi=-1,s=0; cin>>nn; for(int i=1;i<=nn;i++){ scanf("%s%d%d%s%s%d",n[i],&s1,&s2,p1,p2,&lw); m=0; if(s1>80&&lw)m+=8000; if(s1>85&&s2>80)m+=4000; if(s1>90)m+=2000; if(s1>85&&p2[0]=='Y')m+=1000; if(s2>80&&p1[0]=='Y')m+=850; if(m>ma){ ma=m;poi=i; } s+=m; } printf("%s\n",n[poi]); cout<<ma<<endl<<s; }
-
2017-05-13 17:29:44@
type rec=record
l,s1,s2,sum:longint;
g,x:char
end;
var
a:array[1..100] of rec;
st:array[1..100] of string;
t,k,max,i,n:longint;
s:string;
begin
readln(n);
for i:=1 to n do
begin
readln(s);
k:=pos(' ',s);
st[i]:=copy(s,1,k-1);
delete(s,1,k);
k:=pos(' ',s);
val(copy(s,1,k-1),a[i].s1);
delete(s,1,k);
k:=pos(' ',s);
val(copy(s,1,k-1),a[i].s2);
delete(s,1,k);
a[i].g:=s[1];
a[i].x:=s[3];
delete(s,1,4);
val(s,a[i].l);
end;
for i:=1 to n do
begin
a[i].sum:=0;
if (a[i].s1>80) and (a[i].l>=1)then a[i].sum:=a[i].sum+8000;
if (a[i].s1>85) and (a[i].s2>80) then a[i].sum:=a[i].sum+4000;
if a[i].s1>90 then a[i].sum:=a[i].sum+2000;
if (a[i].s1>85) and (a[i].x='Y') then a[i].sum:=a[i].sum+1000;
if (a[i].s2>80) and (a[i].g='Y')
then a[i].sum:=a[i].sum+850;
end;
t:=0;
for i:=1 to n do
begin
t:=t+a[i].sum;
if a[i].sum>max then max:=a[i].sum;
end;
i:=1;
while a[i].sum<>max do
i:=i+1;
writeln(st[i]);
writeln(a[i].sum);
writeln(t);
end.
- 1