#include
<
iostream
>
using
namespace
std;
int
d[
6
];
bool
isok
=
false
;
int
total
=
0
;
void
Try(
int
i,
int
total )
{
if
( total
==
0
)
{
isok
=
true
;
return
;
}
if
( i
<
0
)
return
;
for
(
int
j
=
d[i]; j
>=
0
; j
--
)
{
if
( isok )
break
;
if
( total
-
j
*
(i
+
1
)
>=
0
&&
!
isok )
Try( i
-
1
, total
-
j
*
(i
+
1
) );
}
}
int
main()
{
int
num
=
1
;
while
( scanf(
"
%d%d%d%d%d%d
"
, d
+
0
, d
+
1
, d
+
2
, d
+
3
, d
+
4
, d
+
5
),
d[
0
]
+
d[
1
]
+
d[
2
]
+
d[
3
]
+
d[
4
]
+
d[
5
]
!=
0
)
{
total
=
0
;
for
(
int
i
=
0
; i
<
6
;
++
i )
{
d[i]
%=
60
;
total
+=
(i
+
1
)
*
d[i];
}
if
( total
&
1
)
{
printf(
"
Collection #%d:\n
"
,num
++
);
printf(
"
Can't be divided.\n
"
);
printf(
"
\n
"
);
continue
;
}
isok
=
false
;
Try(
5
, total
/
2
);
printf(
"
Collection #%d:\n
"
,num
++
);
if
(
!
isok )
printf(
"
Can't be divided.\n
"
);
else
printf(
"
Can be divided.\n
"
);
printf(
"
\n
"
);
}
return
0
;
}
posted on 2008-10-01 15:38
Darren 阅读(545)
评论(0) 编辑 收藏 引用 所属分类:
搜索