結果
| 問題 | No.2209 Flip and Reverse |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-16 11:24:14 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 188 ms / 2,000 ms |
| コード長 | 703 bytes |
| 記録 | |
| コンパイル時間 | 82 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 14,676 KB |
| 最終ジャッジ日時 | 2024-09-18 09:17:21 |
| 合計ジャッジ時間 | 5,589 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
n = int(input())
s = input()
t = input()
#SとTの一致しない文字数を数える
def count1(s: str, t: str) -> int:
counter = 0
return counter
#SとTに含まれる1の数の偶奇が異なる場合
def count2(s: str, t: str) -> int:
counter = 0
if (s.count("1") % 2 ) == (t.count("1") % 2 ):
for i in range(len(s)):
if s[i] != t[i]:
counter += 1
elif (s.count("1") % 2 ) != (t.count("1") % 2):
t = t[::-1]
for j in range(len(s)):
if s[j] != t[j]:
counter += 1
return counter
def main():
print(count2(s, t))
if __name__ == "__main__":
main()