#include
<
iostream
>
using
namespace
std;
int
N,M;
int
a[
50
];
int
f[
10010
];
int
main()
{
cin
>>
N
>>
M;
for
(
int
i
=
0
;i
<
M;
++
i)
cin
>>
a[i];
f[
0
]
=
1
;
for
(
int
i
=
1
;i
<=
N;
++
i){
f[i]
=
0
;
for
(
int
j
=
0
;j
<
M;
++
j)
if
(i
>=
a[j]
&&!
f[i
-
a[j]]){
f[i]
=
1
;
break
;
}
}
if
(f[N]) cout
<<
1
<<
endl;
else
cout
<<
2
<<
endl;
return
0
;
}
posted on 2009-05-29 00:28
xfstart07 阅读(142)
评论(0) 编辑 收藏 引用 所属分类:
代码库