結果

問題 No.3254 Xor, Max and Sum
ユーザー ルク
提出日時 2025-09-05 22:15:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 398 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 82,412 KB
実行使用メモリ 54,396 KB
最終ジャッジ日時 2025-09-05 22:15:46
合計ジャッジ時間 3,894 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
if n % 2 == 0:
    print(m * n)
    exit()
草 = [0] * (35)
s = bin(m)[2:].zfill(35)
f = -1
for i in range(0, 35):
    if s[i] == "1" and f == -1:
        f = i
    草[i] = (n-2 if s[i] == "1" else 0)
for i in range(f+1, 35):
    草[i] += 1
ans = 0
for i in range(35):
    ans += 草[i] * (2**(34-i))
    if 草[i] % 2 == 1:
        ans += (2**(34-i))
print(ans)
0