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

WA的弟兄们注意了!!!

Posted by lithum at 2009-08-10 12:16:02 on Problem 2249
没有边乘边除的朋友请看后面其它的帖子。
我遇到的情况是:
__int64 C(int n,int k)
{
	__int64 ans=1;
	__int64 temp=1;
	int i;
	if(k>n/2) k=n-k;
	for(i=k;i>=1;i--)
	{
		ans*=(n-k+i);
		if(ans%i==0) ans/=i;
		else temp*=i;
	}
	return ans/temp;
}
在这个函数里ans,temp的定义一定不能写成 __int64 ans=1,temp=1; 而是要按上面的写法一个一个地定义,否则定义以后temp变量其实是int型的!!!
个人WA了5次,最近rp暴降啊~~~~~~

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