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 VisualFans at 2009-04-11 18:38:45 on Problem 2249
TLE。。。。
#include <iostream>
using namespace std;
__int64 c(int n,int k)
{
	int ans = 1 , temp = 1;
	for(int i = k ; i >= 1 ; i --)
	{
		ans *= n-k+i;
		if(i % ans == 0) ans /= i;
		else temp *= i;
	}
	return ans/temp;
}
int main()
{
	int n , k;
	while(scanf("%d%d",&n,&k)!=EOF)
	{
		if(!(k+n)) break;
		printf("%I64d\n",c(n,k));
	}
}
写进去就AC了

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