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

Re:用公式,还是要打表的

Posted by LongWeixin at 2019-07-16 11:06:34 on Problem 1423
In Reply To:用公式,还是要打表的 Posted by:AB38017032 at 2012-07-30 15:45:30
> #include <stdio.h>
> #include <math.h>
> int a[10000001]={0};
> int main()
> {
> 	int n,len,j,m;
> 	double i,sum=0.0;
>     for(i=1.0;i<10000001;i++)
> 	{
> 		sum+=log10(i);
> 		a[(int)(i)]=(int)(sum)+1;
> 	}
> 	scanf("%d",&n);
> 		/*sum=0.0;
> 		for(i=1.0;i<=(double)(n);i++)
> 			sum+=log10(i);
> 		len=(int)(sum)+1;*/
> 	for(j=0;j<n;j++)
> 	{
> 		scanf("%d",&m);
> 		printf("%d\n",a[m]);
> 	}
> 	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