讨论 / 谁能告诉我怎会么会出这种问题?关于“谁拿了最多奖学金”
xiaoyangr32 2012-08-08 06:08:00
点我顶贴 收藏 删除
program pl;

var s,b,c,f,m:array[1..100] of integer;{s是总和,b是成绩,c是班议,f是发表论文篇数}

a,d,e:array[1..100] of string;{a是姓名,d是是否西藏,e是是否班干部}

n,i,j,t,l:integer;

begin

read(n);

for i:=1 to n do

read(a[i],b[i],c[i],d[i],e[i],f[i]);{读入数据}

for i:=1 to n do

begin

if (b[i]>80) and (f[i]>=1) then s[i]:=s[i]+8000;

if (b[i]>85) and (c[i]>80) then s[i]:=s[i]+4000;

if (b[i]>90) then s[i]:=s[i]+2000;

if (b[i]>85) and (d[i]='y') then s[i]:=s[i]+1000;

if (c[i]>80) and (e[i]='y') then s[i]:=s[i]+850;

m[i]:=s[i];

end;

for i:= 1 to n do

begin

for j:= 1 to n do

if (s[j]>s[j+1]) then

begin

t:=s[j];

s[j]:=s[j+1];

s[j+1]:=t;

end;

end;

for i:=1 to n do

if (m[i]=s[1]) then begin writeln(a[i]);writeln(m[i]); end;

for i:=1 to n do

l:=l+s[i];

writeln(l);

end.

好像是因为输入有问题

还有大家有没有感觉上这儿的速度慢了许多

#1 膜拜王昱炜大神@2012-07-25 07:56:00
回复 删除
好东西,哈哈

[url=/Redirect.asp?Act=Reply&DID=9863&RID=9863]点击这里有好东西[/url]

哈哈,这个帖子……哈哈,太有意思了,你别问我怎么调链接的

#2 1233211234567@2012-08-08 06:08:00
回复 删除
回复楼主

你明显错了

你的变量声明为字符串类型,而读入时你要分开读是不可能的,因为空格也是字符,你用

字符串读,然后用POS配合COPY就可以了

查看更多回复
提交回复