結果
問題 | No.2209 Flip and Reverse |
ユーザー |
|
提出日時 | 2023-02-10 21:23:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 412 bytes |
コンパイル時間 | 1,388 ms |
コンパイル使用メモリ | 167,212 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 15:31:22 |
合計ジャッジ時間 | 2,853 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; string s, t; cin >> n >> s >> t; int ans = 0; for(int i = 0; i < n; i++)ans += (s[i] != t[i]); if(ans & 1){ ans = 0; reverse(s.begin(), s.end()); for(int i = 0; i < n; i++)ans += (s[i] != t[i]); } cout << ans << '\n'; }