結果
| 問題 |
No.2209 Flip and Reverse
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2023-04-23 00:00:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 2,000 ms |
| コード長 | 611 bytes |
| コンパイル時間 | 300 ms |
| コンパイル使用メモリ | 42,312 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 10:49:46 |
| 合計ジャッジ時間 | 3,064 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 2209.cc: No.2209 Flip and Reverse - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_N = 1000000;
/* typedef */
/* global variables */
char s[MAX_N + 4], t[MAX_N + 4];
/* subroutines */
int cntdiff(int n, char s[], char t[]) {
int cnt = 0;
for (int i = 0; i < n; i++)
if (s[i] != t[i]) cnt++;
return cnt;
}
/* main */
int main() {
int n;
scanf("%d%s%s", &n, s, t);
int c0 = cntdiff(n, s, t);
reverse(s, s + n);
int c1 = cntdiff(n, s, t);
printf("%d\n", (! (c0 & 1)) ? c0 : c1);
return 0;
}
tnakao0123