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 sparkling at 2007-07-10 17:44:03 on Problem 3252
   使用double类型计算的组和数转换成long类型竟然有误差,
像C(30, 16),结果必定是整数啊,哪来的误差,没想明白。

int i;
double sum;
sum = 1;
for(i = 0; i < k; i++)
	sum *= (n - i);
for(i = 1; i <= k; i++)
	sum /= i;
return (long)sum;
请高手帮忙看看

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