关于PASCAL的215 错误 高手进!!

[复制链接]
查看11 | 回复2 | 2010-5-21 20:59:31 | 显示全部楼层 |阅读模式
各位神牛帮忙看看这代码!
为什么会是215错误?
program ple;
var t,w,v:array[0..1000] of longint;

f:array[0..25,0..80] of longint;

i,j,k,o,m,n,temp,ans:longint;
function getf(x,y:longint):longint;
begin
if (x<=0) and (y<=0) then exit(0);
if x<=0 then x:=1;
if y<=0 then y:=1;
exit(f[x,y]);
end;
begin
assign(input,'ple.in');
reset(input);
assign(output,'ple.out');
rewrite(output);
readln(o,n);
readln(m);
for i:=1 to 21 do
for j:=1 to 79 do
f[i,j]:=maxlongint-1;
for i:=1 to n do
for j:=o downto 1 do
for k:=n downto 1 do
begin
ans:=getf(j-t,k-v);
temp:=w+ans;
if temp<f[j,k] then f[j,k]:=temp;
end;
writeln(f[o,n]);
close(input);
close(output);
end.
数据:
5 60
5
3 36 120
10 25 129
5 50 250
1 45 130
4 20 119
那怎么改呢?

回复

使用道具 举报

千问 | 2010-5-21 20:59:31 | 显示全部楼层
你的下标不够,也就是下标越界
回复

使用道具 举报

千问 | 2010-5-21 20:59:31 | 显示全部楼层
下表定义长一点
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行