当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3464:Approximations

题目描述

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:

  • 0.2503
  • 0.250
  • 0.25
  • 0.3
  • 0.

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 ≤ iN) 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.
Each of the next N lines contains a decimal fraction Ai. The total number of digits of the N decimal fractions doesn't exceed 400000. There is always a radix point, so zero is "0." instead of "0".

输出解释

One integer, the maximized sum.

输入样例
4
0.250
0.2506
0.25115
0.2597
输出样例
11
提示
x = 0.25115.

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3464

最后修改于 2020-10-29T07:02:15+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000 131072