|Online Judge||Problem Set||Authors||Online Contests||User|
For any decimal fraction, we can obtain a set of approximations of different accuracy by mean of rounding. Take 0.2503 for example, we have the following approximations:
If two fractions A and B can both be rounded to C, we call C a common approximation of A and B. Two fractions may have more than one common approximations, each having a distinct accuracy. For example, 0.2503 and 0.2504 have common approximations 0.250 and 0.25. The accuracy of the former is 10−3, while that of the latter is 10−2. Among all common approximations of two fractions, there is one that has the highest accuracy, and we call it the most accurate common approximation (MACA) of the two fractions. By this definition, the MACA of 0.2503 and 0.2504 is 0.250.
Given N fractions Ai (1 ≤ i ≤ N) in the range [0, 0.5), find a fraction x that maximizes the sum of −log10 (the accuracy of the MACA of Ai and x). Report that maximized sum.
The first line contains one integer N. N ≤ 100000.
One integer, the maximized sum.
4 0.250 0.2506 0.25115 0.2597
x = 0.25115.
POJ Monthly--2007.11.25, Yang Yi
[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