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 ferrettemp at 2005-01-25 15:12:04 on Problem 1401
#include <stdio.h>
#include <math.h>
void main()
{
	int i,temp;
	long n,xinxi[12],sum,ferret[12],t;
	xinxi[1]=1,ferret[1]=5;
	for (i=2;i<12;i++)
	{
		xinxi[i]=xinxi[i-1]*5+1;
		ferret[i]=5*ferret[i-1];
	}
	scanf("%ld",&t);
	while (t-->0)
	{
		scanf("%ld",&n);
		if (n==5)
		{
			printf("1\n");
			continue;
		}
		sum=0;
		for (i=11;i>0&&n>5;i--)
		{
			if (ferret[i]>n)
				continue;
			else
			{
				temp=(int)n/ferret[i];
				sum+=temp*xinxi[i];
				n-=temp*ferret[i];
			}
		}
		printf("%ld\n",sum);
	}
}

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