level 3
12我i
楼主
program fdtr;
type fd=record
go,dis:integer;
end;
var n,m:longint;
sum,su,jr,i,j:longint;
a:array[1..10000,0..100] of fd;
begin
read(n,m);
for i:=1 to n do
for j:=0 to m-1 do
read(a[i,j].go,a[i,j].dis);
read(jr); sum:=0;
for i:=1 to n do begin
su:=a[i,jr].dis; sum:=sum+su;
j:=jr;
while su>0 do begin
if a[i,j].go=1 then dec(su);
inc(j); if j=m then j:=0;
end;
dec(j); if j=-1 then j:=m-1;
jr:=j;
end;
writeln(sum mod 20123);
end.
为什么此程序只过了5点?求大神指点
2013年10月15日 14点10分
1
type fd=record
go,dis:integer;
end;
var n,m:longint;
sum,su,jr,i,j:longint;
a:array[1..10000,0..100] of fd;
begin
read(n,m);
for i:=1 to n do
for j:=0 to m-1 do
read(a[i,j].go,a[i,j].dis);
read(jr); sum:=0;
for i:=1 to n do begin
su:=a[i,jr].dis; sum:=sum+su;
j:=jr;
while su>0 do begin
if a[i,j].go=1 then dec(su);
inc(j); if j=m then j:=0;
end;
dec(j); if j=-1 then j:=m-1;
jr:=j;
end;
writeln(sum mod 20123);
end.
为什么此程序只过了5点?求大神指点