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

ac

Posted by xingning001 at 2005-08-31 17:00:09 on Problem 1942
In Reply To:救命啊!我的程序怎么会超时??? Posted by:xingning001 at 2005-08-31 16:01:52
> #include<stdio.h>
> main()
> {
> 	_int64 s;
> 	long a[1000],top,n,m,i;
> 	while(1)
> 	{
> 		scanf("%ld%ld",&n,&m);
> 		if(n==0&&m==0) break;
> 		s=1;top=0;
> 		for(i=n+m;i>n;i--)
> 		{
> 			s*=i;
> 	if(s%(i-n)) 
> 	a[top++]=(i-n);
> 	else s/=(i-n);
> 		}
> 		for(i=0;i<top;i++)
> 			s/=a[i];
> 	printf("%I64d\n",s);
> 	}
> }

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