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 332523 at 2009-01-22 15:56:00 on Problem 1003
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:
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