ToshibaOA #1
Minimize Multiples Of Three
估计简单可在线判题
考点(AI 标注)位运算
One operation adds 1 to or subtracts 1 from a number. Find the minimum total number of operations needed to make every array element divisible by 3.
This site's standard input/output format and supplementary bounds follow this problem's description.
输入格式
The first line contains n (1≤n≤2×10^5), and the second line contains n integers (|a[i]|≤10^9).
输出格式
Output the minimum number of operations.
样例 1
输入:
4
12 21 3 4
输出:
1
样例 2
输入:
2
4 5
输出:
2
样例 3
输入:
3
-2 0 7
输出:
2