Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

哪里错了啊?哪位帮忙看看啊!不胜感激

Posted by c0590401417 at 2005-03-06 18:11:16 on Problem 1014
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator