| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
请那位大虾看一看吧,BBS上提供的数据都能通过,为什么就是WA呢?求求您哪!我将铭记您的大德!我是这样想的:凡是超过2的我都将它%2,最后只剩下诸如1 0 1 0 0 0之类的,然后求和,我只要和数为偶的这些能divided都一一枚举出来即可.可是这样却WA,郁闷啊啊~~
#include<iostream>
using namespace std;
void main()
{
int A[6],i,sum,onenum;
int static num=0;
while(1)
{
sum=0;onenum=0;
for(i=0;i<6;i++)
{
cin>>A[i];
}
if(A[0]==0&&A[1]==0&&A[2]==0&&A[3]==0&&A[4]==0&&A[5]==0)
{break;}
for(i=0;i<6;i++)
{
A[i]=(A[i]%2);
if(A[i]==1){onenum++;}
sum=(A[i]*(i+1))+sum;
}
if(sum%2==0)
{
if(onenum==0)
{
cout<<"Collection #"<<++num<<":"<<endl;
cout<<"Can be divided.";
}
else if(onenum==3)
{
if(A[0]==0&&A[2]==0&&A[4]==0)
{cout<<"Collection #"<<++num<<":"<<endl;
cout<<"Can be divided.";
}
else
for(i=0;i<6;i++)
{
if(A[i]*(i+1)==(sum/2))
{
cout<<"Collection #"<<++num<<":"<<endl;
cout<<"Can be divided.";
break;
}
}
}
else if(onenum==4)
{
if(A[0]==0&&A[4]==0&&A[3]==0&&A[5]==0)
{cout<<"Collection #"<<++num<<":"<<endl;
cout<<"Can't be divided.";
}
else
{
cout<<"Collection #"<<++num<<":"<<endl;
cout<<"Can be divided.";
}
}
else if(onenum==5)
{
cout<<"Collection #"<<++num<<":"<<endl;
cout<<"Can be divided.";
}
else
{
cout<<"Collection #"<<++num<<":"<<endl;
cout<<"Can't be divided.";
}
}
else
{
cout<<"Collection #"<<++num<<":"<<endl;
cout<<"Can't be divided.";
}
cout<<endl;
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator