結果

問題 No.2209 Flip and Reverse
ユーザー srjywrdnprkt
提出日時 2023-05-05 07:24:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 799 ms
コンパイル使用メモリ 105,208 KB
最終ジャッジ日時 2025-02-12 17:07:37
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    int N, ans=0;
    bool f=0;
    string S, T;
    cin >> N >> S >> T;

    for (auto c : S) f ^= c-'0';
    for (auto c : T) f ^= c-'0';

    if (f) reverse(S.begin(), S.end());
    for (int i=0; i<N; i++) if (S[i] != T[i]) ans++;

    cout << ans << endl;

    return 0;
}
0