結果

問題 No.2209 Flip and Reverse
ユーザー daiota
提出日時 2023-02-11 08:54:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 485 bytes
コンパイル時間 1,268 ms
コンパイル使用メモリ 168,376 KB
実行使用メモリ 6,432 KB
最終ジャッジ日時 2024-07-08 00:19:03
合計ジャッジ時間 2,875 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i=0;i<ll(n);i++)

int a[110];

int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	int i,j,k;

	int N;
	string S,T,t;
	cin >> N >> S >> T;

	t=T;
	reverse(t.begin(),t.end());

	int c=0,d=0,ans=0;
	for(i=0;i<N;i++) if(S[i]!=T[i]) c++;

	if(c%2==0) ans=c;
	else{
		for(i=0;i<N;i++) if(S[i]!=t[i]) d++;
		ans=d;
	}

	cout << ans << endl;

	return 0;
}
0