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

怎么总是wrong ......啊,小弟附上代码,,,飘过的神仙帮俺看看,谢谢啦

Posted by qqqymx at 2010-02-18 16:18:26 on Problem 1014
#include<stdio.h>
void main()
{
	__int64 i,j,g,sum,n=0,x,m,a[10],flag=0;
	while(flag==0)
	{
		n++;m=0;
		for(i=0;i<6;i++)
		{
			scanf("%I64d",&a[i]);
		}
		if((a[0]+a[1]+a[2]+a[3]+a[4]+a[5])!=0)
		{
		    sum=1*a[0]+2*a[2]+3*a[3]+4*a[4]+5*a[5]+6*a[6];
		    if(sum%2!=0)
			{
			    printf("Collection #%I64d:\n",n);
			    printf("Can't be divided.\n\n");
			}
	    	else
			{
			    for(i=0;i<4;i++)
				{
				    for(j=i+1;j<5;j++)
					{
					     for(g=j+1;g<6;g++)
						 {
					    	x=a[i]+a[j]+a[g];
					    	if(x==sum/2)
							{
							    m=1;
								break;
							}
						 }
					}
				}
			    if(m==0)
				{
		    		printf("Collection #%I64d:\n",n);
		        	printf("Can't be divided.\n\n");
				}
		    	else
				{
	    			printf("Collection #%I64d:\n",n);
		        	printf("Can be divided.\n\n");
				}
			}
		}
		else
		{
			flag=1;
		}
	}
}

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