IBMOA #59
Minimum Moves to Match Arrays
估计简单可在线判题
考点(AI 标注)位运算模拟/实现
Corresponding integers in the two arrays have the same number of digits. Each operation increases or decreases one decimal digit of some integer in arr1 by 1, without going outside 0..9, without carrying, and without moving digits. Find the minimum number of operations to make it identical to arr2. This is the operation explained digit by digit in the source's first example.
输入格式
The first line contains n, the second line contains arr1, and the third line contains arr2. 1≤n≤100000, 1≤element≤10^9, the two arrays have the same length, and each pair of corresponding integers has the same number of decimal digits.
输出格式
Output one integer, the answer.
样例 1
输入:
2
1234 4321
2345 3214
输出:
10
样例 2
输入:
1
1248
8642
输出:
17
样例 3
输入:
1
9
1
输出:
8
样例说明
The examples give 10, 17 and 8 respectively. In the second example, the original output 16 and the explanation's 15 are both incorrect: 7+4+0+6=17.