/ Vijos / 讨论 / 寻宝 /

# 归来

var i,j,sam,count,qwe,n,m:longint;
a,b:array[1..10000,0..100]of longint;

procedure print;
begin
writeln(count); {close(input);close(output);}
halt;
end;

procedure pre(p:longint);
begin
if p=n+1 then print;
count:=(count+b[p,sam]) mod 20123;
while a[p,sam]=0 do begin inc(sam);if sam=m then sam:=0; end;
qwe:=b[p,sam];
while qwe>0 do begin inc(sam);if sam=m then sam:=0;
if a[p,sam]=1 then dec(qwe);
end;
pre(p+1);
end;

begin
{assign(input,'p1787.in');reset(input);
assign(output,'p1787.out');rewrite(output);}
for i:=1 to n do
begin
for j:=0 to m-1 do
begin
end;
end;
pre(1);
end.

# 1 条评论

• @ 2015-05-12 16:14:11

var i,j,sam,count,qwe,n,m,p:longint;
a,b:array[1..10000,0..100]of longint;

procedure print;
begin
writeln(count); {close(input);close(output);}
halt;
end;
begin
{assign(input,'p1787.in');reset(input);
assign(output,'p1787.out');rewrite(output);}
for i:=1 to n do
begin
for j:=0 to m-1 do
begin
end;
end;

for p:=1 to n do
begin

if p=n+1 then print;

count:=(count+b[p,sam]) mod 20123;qwe:=b[p,sam];

for i:=1 to qwe do
begin
while a[p,sam]=0 do begin inc(sam);if sam=m then sam:=0; end;
if i<>qwe then begin inc(sam);if sam=m then sam:=0; end;
end;

end;

print;
end.
这个50，超时了
众位可否指点？

• 1

ID
1787

6

2633

612

23%

11