/*
贪心水题:累加到目标数字的距离,两头找取最小值
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std; const int MAXN = 1e3 + ;
const int INF = 0x3f3f3f3f;
char s[MAXN], t[MAXN]; int main(void) //Codeforces Round #301 (Div. 2) A. Combination Lock
{
//freopen ("A.in", "r", stdin); int n;
while (scanf ("%d", &n) == )
{
scanf ("%s", &s);
getchar ();
scanf ("%s", &t); int ans = ;
for (int i=; i<n; ++i)
{
int tmp = abs (t[i]-s[i]);
ans += min (tmp, - tmp);
} printf ("%d\n", ans);
} return ;
}
相关文章
- 02-23Codeforces Round #585 (Div. 2) A. Yellow Cards(数学)
- 02-23Codeforces Round #692 (Div. 2, based on Technocup 2021 Elimination Round 3) A. In-game Chat 模拟
- 02-23Codeforces Round #364 (Div. 2)->A. Cards
- 02-23Codeforces Round #545 (Div. 2) D 贪心 + kmp
- 02-23Codeforces Round #734 (Div. 3)_B2. Wonderful Coloring - 2(贪心)
- 02-23Codeforces Round #566 (Div. 2)A. Filling Shapes
- 02-23Codeforces Round #564 (Div. 2) C. Nauuo and Cards(贪心)
- 02-23Codeforces Round #180 (Div. 2) B. Sail 贪心
- 02-23Codeforces Round #604 (Div. 2) A. Beautiful String(贪心)
- 02-23A. Inscribed Figures--简单数学--Educational Codeforces Round 64 (Rated for Div. 2)