Codeforces Round 204 (Div. 1)
A
Jeff and Rounding
Codeforces
1800
原题
←B →
翻译中…

Jeff got $2*n*$ real numbers $*a*_{1}, *a*_{2}, ..., *a*_{2*n*}$ as a birthday present. The boy hates non-integer numbers, so he decided to slightly "adjust" the numbers he's got. Namely, Jeff consecutively executes $*n*$ operations, each of them goes as follows:

翻译中…
  • choose indexes $*i*$ and $*j*$ $(*i* ≠ *j*)$ that haven't been chosen yet;
  • round element $*a*_{*i*}$ to the nearest integer that isn't more than $*a*_{*i*}$ (assign to $*a*_{*i*}$: $⌊ *a*_{*i*} ⌋$);
  • round element $*a*_{*j*}$ to the nearest integer that isn't less than $*a*_{*j*}$ (assign to $*a*_{*j*}$: $⌈ *a*_{*j*} ⌉$).
翻译中…

Nevertheless, Jeff doesn't want to hurt the feelings of the person who gave him the sequence. That's why the boy wants to perform the operations so as to make the absolute value of the difference between the sum of elements before performing the operations and the sum of elements after performing the operations as small as possible. Help Jeff find the minimum absolute value of the difference.

翻译中…

Input

翻译中…

The first line contains integer $*n*$ $(1 ≤ *n* ≤ 2000)$. The next line contains $2*n*$ real numbers $*a*_{1}$, $*a*_{2}$, $...$, $*a*_{2*n*}$ $(0 ≤ *a*_{*i*} ≤ 10000)$, given with exactly three digits after the decimal point. The numbers are separated by spaces.

翻译中…

Output

翻译中…

In a single line print a single real number — the required difference with exactly three digits after the decimal point.

翻译中…

Note

翻译中…

In the first test case you need to perform the operations as follows: $(*i* = 1, *j* = 4)$, $(*i* = 2, *j* = 3)$, $(*i* = 5, *j* = 6)$. In this case, the difference will equal $|(0 + 0.5 + 0.75 + 1 + 2 + 3) - (0 + 0 + 1 + 1 + 2 + 3)| = 0.25$.

翻译中…

样例

Input #1
3
0.000 0.500 0.750 1.000 2.000 3.000
Output #1
0.250
InputCopy OutputCopy
Input #2
3
4469.000 6526.000 4864.000 9356.383 7490.000 995.896
Output #2
0.279
InputCopy OutputCopy
题目信息
题号
351A
时间限制
1 s
内存限制
256 MB
标签
动态规划
贪心
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。