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:求助:为什么TLE?

Posted by lxp20011125 at 2020-10-07 15:53:39 on Problem 1150
In Reply To:求助:为什么TLE? Posted by:zhaoxhtest at 2008-06-10 17:45:54
> 这道题目我的理解是求组合数C(m,n)
> 我的想法把每次乘积的值去掉之后取末位,再次去乘以被乘数。
> 
> 
> #include<stdio.h>
> 
> int main()
> {
> 	int n,m,i,sum;
> 	while(scanf("%d%d",&n,&m)!=EOF)
> 	{
> 		sum=n;
> 		for(i=n-1;i>n-m;i--)
> 		{	
> 		
> 			sum*=i;	
> 			while(sum%10==0)  //删除0
> 		        sum/=10;
> 		    sum%=10;	//取末位	
> 		}
> 		printf("%d\n",sum);
> 	}
> 	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