結果

問題 No.2209 Flip and Reverse
ユーザー YutaYuta
提出日時 2023-03-16 11:24:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 162 ms / 2,000 ms
コード長 703 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 11,760 KB
実行使用メモリ 12,860 KB
最終ジャッジ日時 2023-10-18 12:57:19
合計ジャッジ時間 5,157 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,044 KB
testcase_01 AC 29 ms
10,044 KB
testcase_02 AC 28 ms
10,044 KB
testcase_03 AC 29 ms
10,044 KB
testcase_04 AC 29 ms
10,044 KB
testcase_05 AC 29 ms
10,044 KB
testcase_06 AC 29 ms
10,044 KB
testcase_07 AC 28 ms
10,044 KB
testcase_08 AC 152 ms
12,860 KB
testcase_09 AC 29 ms
10,044 KB
testcase_10 AC 29 ms
10,044 KB
testcase_11 AC 29 ms
10,044 KB
testcase_12 AC 29 ms
10,044 KB
testcase_13 AC 29 ms
10,044 KB
testcase_14 AC 162 ms
12,860 KB
testcase_15 AC 162 ms
12,860 KB
testcase_16 AC 162 ms
12,860 KB
testcase_17 AC 162 ms
12,860 KB
testcase_18 AC 148 ms
12,860 KB
testcase_19 AC 149 ms
12,860 KB
testcase_20 AC 161 ms
12,860 KB
testcase_21 AC 162 ms
12,860 KB
testcase_22 AC 161 ms
12,860 KB
testcase_23 AC 148 ms
12,860 KB
testcase_24 AC 138 ms
12,860 KB
testcase_25 AC 159 ms
12,860 KB
testcase_26 AC 149 ms
12,860 KB
testcase_27 AC 149 ms
12,860 KB
testcase_28 AC 124 ms
12,860 KB
testcase_29 AC 124 ms
12,860 KB
testcase_30 AC 120 ms
12,860 KB
testcase_31 AC 156 ms
12,860 KB
testcase_32 AC 122 ms
12,860 KB
testcase_33 AC 152 ms
12,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
0