結果

問題 No.2323 Nafmo、A+Bをする
ユーザー koshihkarikoshihkari
提出日時 2023-05-28 13:40:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 71,636 KB
最終ジャッジ日時 2023-08-27 08:13:11
合計ジャッジ時間 2,738 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,636 KB
testcase_01 AC 70 ms
71,140 KB
testcase_02 AC 70 ms
71,448 KB
testcase_03 AC 70 ms
71,368 KB
testcase_04 AC 74 ms
71,452 KB
testcase_05 AC 69 ms
71,512 KB
testcase_06 AC 70 ms
71,312 KB
testcase_07 AC 70 ms
71,604 KB
testcase_08 AC 70 ms
71,516 KB
testcase_09 AC 70 ms
71,172 KB
testcase_10 AC 69 ms
71,564 KB
testcase_11 AC 68 ms
71,328 KB
testcase_12 AC 69 ms
71,172 KB
testcase_13 AC 71 ms
71,400 KB
testcase_14 AC 70 ms
71,400 KB
testcase_15 AC 70 ms
71,172 KB
testcase_16 AC 69 ms
71,444 KB
testcase_17 AC 68 ms
71,400 KB
testcase_18 AC 71 ms
71,336 KB
testcase_19 AC 70 ms
71,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a = input()
b = input()

if len(b) > len(a):
    a, b = b, a
    
s = ''
for i in range(len(a)-len(b)):
    s += a[i]

for i in range(len(b)):
    char_a = a[len(a)-len(b)+i]
    char_b = b[i]
    if char_a == '0' and char_b == '0' or char_a == '1' and char_b == '1':
        s += '0'
    else:
        s += '1'

base = 1
ans = 0
for i in range(len(s)):
    ans += base * int(s[len(s)-1-i])
    base *= 2
    
print(ans)
0