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

新手求教~1423Big Number我的代码正确了为什么Time Limit Exceeded?

Posted by aannvvc at 2010-11-25 16:30:16
RT
CODE:
#include<stdio.h>
int factorial(int n)
{
	int i;
	float f=1;
	for(i=1;i<=n;i++)
		f=f*i;
    for(i=1;(f/10)>1;i++)
		f=f/10;
	return i;
}
int main(void)
{
	int n,i,a[80],b[80];
    scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		b[i]=factorial(a[i]);
	}
	for(i=0;i<n;i++)
	printf("%d\n",b[i]);
}

第一次做POJ上的题。。有点小紧张

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