PersonalCorpus 版 (精华区)
157315 05:22:15 8 Mar 2002
Bozhang,HIT,P.R.China 1087 Pascal Accepted 0.03 sec 57K
var
n,m,i,j:integer;
k:array[1..50] of integer;
a:array[0..10000] of boolean;
begin
readln(n,m); for i:=1 to m do begin read(k[i]);if k[i]=0 then k[i]:=n+1;
end;
a[0]:=false;//2
for i:=1 to n do begin
a[i]:=true;
for j:=1 to m do if i>=k[j] then if a[i-k[j]] then begin a[i]:=false
; break; end;
end;
if a[n] then writeln(2) else writeln(1);
end.
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.633毫秒