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

谁能再给一点数据,WA得不行,谁有数据阿,我试过很多个版本的数据都没错阿

Posted by butter at 2006-10-27 23:22:20 on Problem 1117
谁可以帮我测是测试:

#include<stdio.h>

#define MAX 100

long long base[12];

void prepare()
{
	long long i;
	base[1]=10;
	for(i=2;i<12;i++)
		base[i]=base[i-1]*10;
}
int main()
{
	long long a[MAX],n,mod,box;
	long long count,i,j,k;
	prepare();
	while(scanf("%lli",&n)==1)
	{
		count=0;
		if(n%11<10)	a[++count]=n/11;

		if(n%2)
		{
			printf("%lli\n",count);
			if(count) printf("%lli + %lli = %lli\n",n-a[1],a[1],n);
			continue;
		}

		i=1;
		while(base[i]<=n)
		{
			mod=n%(11*base[i]);
			box=n/(11*base[i]);

			if(mod<base[i]*10)	
				a[++count]=box*base[i]+(mod%base[i])/2;
			for(j=1;j<count;j++)
				if(a[j]==a[count])
				{
					count--;
					break;
				}

			if(mod>=base[i])
				a[++count]=box*base[i]+(base[i]+mod%base[i])/2;
			if(n-a[count]==a[count])
				count--;
			for(j=1;j<count;j++)
				if(a[j]==a[count])
				{
					count--;
					break;
				}
			i++;
		}

		for(i=1;i<count;i++)
			for(j=i+1;j<=count;j++)
				if(a[i]<a[j])
				{
					box=a[i];
					a[i]=a[j];
					a[j]=box;
				}
		
		printf("%lli\n",count);	
		for(i=1;i<=count;i++)
		{
			for(j=1;a[i]/base[j];j++);
			for(k=1;(n-a[i])/base[k];k++);
			k-=j+1;
			printf("%lli + ",n-a[i]);
			for(j=1;j<=k;j++)
				putchar('0');
			printf("%lli = %lli\n",a[i],n);
		}
	}
	return 0;
}

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