Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
竟然有误差~~使用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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator