Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
Statistical Charts
Submit Problem
Online Status
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
欢迎参加IJCAI 2020麻将智能体竞赛,大奖等你拿!Welcome to IJCAI 2020 Mahjong AI competition with amazing prizes!
Match Throwing Game
Time Limit: 1000MSMemory Limit: 65536K
Total Submissions: 1080Accepted: 325


There is a very simple but interesting game. In this game we have a match and a table with some parallel lines on it (as shown in the figure). We have known that the distance between two neighboring lines on the table are all 1 and the length of the match is L. For the match is very thin, we ignore the width of the match, and treat the match as a line segment. Then we throw the match for 1000 times, sometimes the match will intersect with lines (the case that one ending point of the match is on the lines is also treated as intersecting), and sometimes not. When throwing, we count how many times the match intersects with the lines (we use P to record the number of intersecting cases). You job is to calculate the most probable value of P.

Why this game is interesting? Let's take L = 0.5 for example, in this case, P will be 318. 1000 / 318 = 3.14..., do you see something interesting?


The input consists of many test cases. Each case contains a float number L (0 < L < 10) in a single line.


For each case, output P in a single line.

Sample Input


Sample Output



[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator