結果
| 問題 |
No.2209 Flip and Reverse
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-16 10:42:51 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 628 bytes |
| コンパイル時間 | 252 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 20,956 KB |
| 最終ジャッジ日時 | 2024-09-18 09:16:35 |
| 合計ジャッジ時間 | 4,629 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 4 TLE * 1 -- * 25 |
ソースコード
n = int(input())
s = input()
t = input()
#SとTの一致しない文字数を数える
def count(s, t):
counter = 0
for i in range(len(s)):
if s[i] != t[i]:
counter += 1
return counter
#Sを反転した後のTとの違い
def count2(s, t):
counter2 = 0
for j in range(len(s)):
s = s[::-1]
if s[j] != t[j]:
counter2 += 1
return counter2
def count3(s, t):
counter3 = 0
for q in range(len(s)):
s = s[0] + s[1:][::-1]
if s[q] != t[q]:
counter3 += 1
return counter3
print(min(count(s,t), count2(s, t), count3(s, t)))