- 笨笨的道路通行
- 2009-10-31 23:59:01 @
program vijos;
var n,i,k,j,o,l : longint;
a : array[1..1050] of longint;
b,b1 : array[0..1050] of boolean;
begin
readln(o);
for l := 1 to o do
begin
readln(n);
fillchar(a,sizeof(a),0);
for i := 1 to n do
read(a[i]);
fillchar(b,sizeof(b),0);
b[0] := true;
for k := 1 to maxlongint do
begin
fillchar(b1,sizeof(b1),0);
b1[0] := true;
for j := 1 to n+1 do
if (j=n+1) or (k mod a[j] 0) then
b1[j] := b[j-1] or b[j] or b[j+1];
if b1[n+1] then begin writeln(k); break; end;
b := b1;
if k > 100000 then begin writeln('You can''t cross the road!'); break end;
end;
end;
end.
怎么搞都是65分,,看记录1651貌似真的好多好多65分的额,,错的全部是无解的情况,,可是应该无解判断了啊。。哪位ac的大牛能不能提示下这么判断的无解、、?或是题目哪里有点阴险。。??
1 条评论
-
extended LV 10 @ 2009-11-01 10:14:19
囧,,大牛大牛哇,有没有人能提示一下啊,无解有特殊的么......
- 1