| ||||||||||
| 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 | |||||||||
哪里错了啊?哪位帮忙看看啊!不胜感激#include<stdio.h>
void main() {
int n[6],l[6]={6,5,5,5,6,5},i,tot=0,value,r[40],c=0,k=0;
for(i=0;i<6;i++){
scanf("%d",&n[i]);
if(n[i]==0) tot++;
}
while(tot!=6){
k++;
value=0;
for(i=0;i<6;i++){
if(n[i]>=l[i]) n[i]=l[i]-(n[i]-l[i])%2;
value+=n[i]*(i+1);
}
if(value%2==1){
r[k]=0;
}
else{
value=value/2;
while(value>0){
if(value<=6){
if(n[value-1]!=0){
value=0;
break;
}
}
for(i=0;i<6;i++){
if(n[i]!=0){
n[i]=n[i]-1;
value=value-(i+1);
break;
}
}
}
if(value==0) r[k]=1;
else r[k]=0;
}
tot=0;
for(i=0;i<6;i++){
scanf("%d",&n[i]);
if(n[i]==0) tot++;
}
}
for(i=1;i<=k;i++){
c++;
if(r[i]==0) printf("Collection #%d:\nCan't be divided.\n\n",c);
else printf("Collection #%d:\nCan be divided.\n\n",c);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator