CF351A Jeff and Rounding
题目描述
题意:
你有一个长度为 $2n$ 的序列 $a$,将其中的 $n$ 个数向下取整,剩余 $n$ 个数向上取整,设操作完后的序列为 $b$,求 $|\sum_{i=1}^{2n} a_i - \sum_{i=1}^{2n}b_i|$ 的最小值.
输入格式
第一行包含一个整数 $n\ (1\le n\le 2\times10^3)$;
下面一行包含 $2n$ 个三位小数 $a_1,a_2,\cdots,a_{2n}\ (0\le a_i\le 10^4)$。
输出格式
仅一行,即题中所求的最小值(也恰好为三位小数)。
说明/提示
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 $ .