- 谁拿了最多奖学金
- 2008-12-17 12:24:57 @
var n,i,j,t:integer;
max:int64;
st:string;
a:array[0..101] of string;
b:array[0..101] of integer;
procedure aa(st:string; i:integer);
var x,y,z,p,c,sum:integer;
st1,st2:char;
m:string;
begin
p:=pos(' ',st); m:=copy(st,1,p-1); delete(st,1,p); a[i]:=m;
p:=pos(' ',st); m:=copy(st,1,p-1); delete(st,1,p); val(m,x,c);
p:=pos(' ',st); m:=copy(st,1,p-1); delete(st,1,p); val(m,y,c);
st1:=st[1];
st2:=st[3];
delete(st,1,4);
val(st,z,c);
sum:=0;
if (x>80)and(z>0) then sum:=sum+8000;
if (x>85)and(y>80) then sum:=sum+4000;
if (x>90) then sum:=sum+2000;
if (x>85)and(st2='Y') then sum:=sum+1000;
if (x>80)and(st1='Y') then sum:=sum+850;
b[i]:=sum; max:=max+sum;
end;
begin
readln(n);
for i:=1 to n do
begin
readln(st);
aa(st,i);
end;
for i:=1 to n-1 do
for j:=n downto i+1 do
if (b[j]>b[j-1])or(b[j]=b[j-1])and(a[j]
1 条评论
-
dsxds LV 5 @ 2025-07-11 22:18:44
用c++更省事
#include<iostream> #include<cstring> using namespace std; int main() { int n,i,zq=0,q=0,chengji1,chengji2,lunwen=0,maxn=0,t=0,j; char yes=0,yes1=0; string name[100]; cin>>n; for(i=0;i<n;i++) { cin>>name[i]>>chengji1>>chengji2>>yes>>yes1>>lunwen; q=0; if(chengji1>80&&lunwen>0) { zq+=8000; q+=8000; } if(chengji1>85&&chengji2>80) { zq+=4000; q+=4000; } if(chengji1>90) { zq+=2000; q+=2000; } if(chengji1>85&&yes1=='Y') { zq+=1000; q+=1000; } if(chengji2>80&&yes=='Y') { zq+=850; q+=850; } if(q>maxn) { maxn=q; t=i; } } cout<<name[t]<<"\n"<<maxn<<"\n"<<zq; return 0; }
- 1