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 |
格式变下In Reply To:为什么递归的返回值总是0.5?请帮忙 Posted by:scuttemp at 2009-01-12 21:49:41 因为你开始定义的n是整型吧,1/n(n>1)做完就是0,你又定义n=2是0.5,所以sum=0.5+0+0+....0=0.5,你把它改成float(1/n)再试试 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator