結果

問題 No.2323 Nafmo、A+Bをする
ユーザー sepa38sepa38
提出日時 2023-04-22 17:03:36
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 479 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 65,152 KB
最終ジャッジ日時 2024-04-24 20:15:14
合計ジャッジ時間 2,423 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,840 KB
testcase_01 AC 40 ms
52,096 KB
testcase_02 AC 40 ms
52,224 KB
testcase_03 AC 41 ms
51,968 KB
testcase_04 AC 39 ms
51,712 KB
testcase_05 AC 41 ms
52,224 KB
testcase_06 AC 40 ms
52,096 KB
testcase_07 AC 40 ms
51,968 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

a = int(input())
b = int(input())
assert 0 <= a <= 1 << 30
assert 0 <= b <= 1 << 30
a = list(map(int, str(a)))
b = list(map(int, str(b)))
assert max(a) == 1
assert max(b) == 1
assert len(a) > 1 and a[0] == 1 or len(a) == 1
assert len(b) > 1 and b[0] == 1 or len(b) == 1
if len(a) > len(b):
  a, b = b, a
res = [0] * 31
for i in range(len(a)):
  res[~i] = a[~i] ^ b[~i]
for i in range(len(a), len(b)):
  res[~i] = b[~i]
ans = 0
for i in range(31):
  ans += res[~i] << i
print(ans)
0