結果

問題 No.2209 Flip and Reverse
ユーザー Manuel1024
提出日時 2023-02-10 21:28:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 546 ms
コンパイル使用メモリ 70,104 KB
実行使用メモリ 7,184 KB
最終ジャッジ日時 2024-07-07 15:39:18
合計ジャッジ時間 2,959 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int n; cin >> n;
    string s, t;
    cin >> s;
    cin >> t;

    int cnt1 = 0, cnt2 = 0;
    for(int i = 0; i < n; i++){
        if(s[i] != t[i]) cnt1++;
    }
    for(int i = 0; i < n; i++){
        if(s[i] != t[n-i-1]) cnt2++;
    }
    cout << min(cnt1+cnt1%2, cnt2+(1-cnt2%2)) << endl;
    return 0;
}
0