#include <stdio.h>
int n[6];
int main()
{
freopen("in.txt","r",stdin);
int a=0;
while(1)
{
for(int i=0;i<6;i++)
scanf("%d",&n[i]);
if((n[0]==0)&&(n[1]==0)&&(n[2]==0)&&(n[3]==0)&&(n[4]==0)&&(n[5]==0))
break;
a++;
int sum=0;
for(int i=0;i<6;i++)
sum=sum+n[i]*(i+1);
if(sum%2==0)
{
int c=0,b=0;
for(int i=5;i>=0;i--)
{
if(c>b)
{
b+=n[i]*(i+1);
}
else
{
c+=n[i]*(i+1);
}
}
if((c==b)&&(c!=0))
{
printf("Collection #%d:",a);
printf("Can be divided.");
printf("\n");
}
if(c!=b)
{
printf("Collection #%d:",a);
printf("Can't be divided.");
printf("\n");
}
}
else
{
printf("Collection #%d:",a);
printf("Can't be divided.");
printf("\n");
}
}
return 0;
}
http://www.cnblogs.com/ACShiryu/archive/2011/07/23/2114718.html