您的位置:首页 > 其它

谁拿了最多的奖学金-pascal

2012-03-15 11:22 211 查看
题目描述略,巨水无比

View Code

program sky;
var
n,i,k,kk,lun,ans : longint;
c            : char;
s            : string;
f,q            : array[0..1000] of longint;
a            : array[0..1000] of string[25];
bj,bjj        : boolean;
procedure qs(l,r    : longint );
var
i,j,z,zz  : longint;
tp,tpp,kk : longint;
tps         : string[25];
begin
i:=l; j:=r; kk:=random(r-l+1)+l;
z:=f[kk]; zz:=q[kk];
repeat
while ((f[i]>z) or ((f[i]=z) and (q[i]<zz))) do inc(i);
while ((f[j]<z) or ((f[j]=z) and (q[j]>zz))) do dec(j);
if i<=j then
begin
tp:=f[i]; f[i]:=f[j]; f[j]:=tp;
tpp:=q[i]; q[i]:=q[j]; q[j]:=tpp;
tps:=a[i]; a[i]:=a[j]; a[j]:=tps;
inc(i); dec(j);
end;
until i>j;
if i<r then qs(i,r);
if l<j then qs(l,j);
end;
begin
readln(n);
randomize;
for i:=1 to n do q[i]:=i;
for i:=1 to n do
begin
read(c);
s:=c;
while c<>' ' do begin read(c); s:=s+c; end;
delete(s,length(s),1);
a[i]:=s;
read(k,kk);
read(c); read(c);
if c='Y' then bj:=true;
read(c); read(c);
if c='Y' then bjj:=true;
readln(lun);
if (k>80) and (lun<>0) then inc(f[i],8000);
if (k>85) and (kk>80) then inc(f[i],4000);
if (k>90) then inc(f[i],2000);
if bjj and (k>85) then inc(f[i],1000);
if bj and (kk>80) then inc(f[i],850);
inc(ans,f[i]);
bj:=false; bjj:=false;
end;
qs(1,n);
writeln(a[1]);
writeln(f[1]);
writeln(ans);
end.


Runtimeerror了N次,快排打错了,哎,这都能错

还有就是双关键字排序第二关键字按字符串大小写了一个。。没看题阿。。。。

就这样吧。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: