讨论 / 我的代码怎么不能编译?大牛 我急啊
sisi 2007-11-12 03:07:00
点我顶贴 收藏 删除
program p111;

type

node=record

name,sum:string;

l:integer;

end;

var

a:array[1..5000] of node;

n,i:integer;

function ok(l1,l2:integer;x1,x2,y1,y2:string):boolean;

begin

if l1>l2 then exit(true);

if l1<l2 then exit(false);

if x1>x2 then exit(true);

if x1<x2 then exit(false);

if y1<y2 then exit(true);

if y1>y2 then exit(false);

end;

procedure qsort(l,r:integer);

var i,j,k,l11:integer;

t:node;

n1,f1:string;

begin

i:=l; j:=r; l11:=a[(l+r)div 2].l;

n1:=a[(l+r)div 2].name; f1:=a[(l+r)div 2].sum;

repeat

while (i<r) and ok(a[i].l,l11,a[i].sum,f1,a[i].name,n1) do inc(i);

while (j>l) and ok(l11,a[j].l,f1,a[j].sum,n1,a[j].name) do dec(j);

if i<=j then

begin

t:=a[i]; a[i]:=a[j]; a[j]:=t;

inc(i); dec(j);

end;

until i>j;

if i<r then qsort(i,r);

if j>l then qsort(l,j);

end;

begin

assign(input,ne.in);

reset(input);

readln(n);

for i:=1 to n do

begin

readln(a[i].name);

readln(a[i].sum);

while a[i].sum[1]=0 do delete(a[i].sum,1,1);

a[i].l:=length(a[i].sum);

end;

close(input);

qsort(1,n);

for i:=1 to n do writeln(a[i].name);

end.

#1 sisi@2007-11-11 18:01:00
回复 删除
严重抗议

我在自己的机子上能全过

在RJ上有时10分 有时0分

另附高考0分作文片段

太阳给草打电话,太阳:喂,草你吗,我日。草:我草,你谁啊?太阳:我日啊;草:我草,你到底谁啊太阳:我日啊,你草吧草:,你到底是谁啊,我草;太阳:我日,我日啊;草:我草.这时,太阳的妈妈接过电话:我日他妈呀,你是草吧,草你妈呢!

  我非常讨厌说粗口,谁他妈的说粗口我就鄙视他!所以我们在平时学母语对于那些粗口或者引起歧义的词语就要好对待!

#2 克隆牛@2007-11-11 18:56:00
回复 删除
佩服楼上的勇气!

var

ff,f,path:array[0..200000] of longint;

ans:array[0..100] of boolean;

a,b,c:array[1..100] of longint;

j,i,n,t:longint;

begin

readln(n,t);

for i:=1 to n do

begin

readln(a[i],b[i],c[i]);

a[i]:=a[i]*c[i];

b[i]:=b[i]*c[i];

end;

fillchar(f,sizeof(f),0);

fillchar(ff,sizeof(ff),0);

for i:=1 to n do

for j:=t downto a[i] do

if (b[i]+f[j-a[i]])>f[j] then

begin

path[j]:=i;

f[j]:=b[i]+f[j-a[i]];

if ff[j]=0 then

ff[f[j]]:=i;

end;

for i:=f[t] downto 0 do

if ff[i]>0 then

begin

while (i>0) do

begin

ans[ff[i]]:=true;

i:=i-b[ff[i]];

end;

for i:=1 to n do

if ans[i] then

write(i, );

halt;

end;

end.

9260.pas(31,16) Error: Illegal assignment to for-loop variable "i"

9260.pas(38,4) Fatal: There were 1 errors compiling module, stopping

9260.pas(38,4) Fatal: Compilation aborted

猫,解释下什么原因。 我在电脑上能运行,交上来就这个错误5555

#3 renqing@2007-11-12 01:32:00
回复 删除
LS

write(i, );这句什么意思?应该是write(i,’ ’);吧

#4 stone!@2007-11-12 01:44:00
回复 删除
我代表猫回答楼主问题:

1:你是不是FP下编译?还是用word写的?因为你的分号复制到FP中,显示为异常字符。

2:assign这个标识符不可以在RQ使用

3:在使用assign时 要使用引号括住文件名

如:assign(input,1.in);

4:while a[i].sum[1]=0 do delete(a[i].sum,1,1);语句有问题

5:请自己编译通过再寻求帮助。别人的时间也很宝贵。

特别是猫

#5 stone!@2007-11-12 01:45:00
回复 删除
上面例子错误

应该是assign(input,1.in);

#6 michael@2007-11-12 03:05:00
回复 删除
我代表楼主感谢

你们

#7 michael@2007-11-12 03:07:00
回复 删除
我知道楼主和3楼为什么会有些地方没显出来

是因为网站会吃一些代码

oibh也会

查看更多回复
提交回复