結果

問題 No.1452 XOR×OR
ユーザー lam6er
提出日時 2025-03-20 20:28:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 296 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 82,840 KB
実行使用メモリ 59,628 KB
最終ジャッジ日時 2025-03-20 20:29:21
合計ジャッジ時間 3,047 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
factors = set()

for i in range(1, int(n**0.5) + 1):
    if n % i == 0:
        factors.add(i)
        factors.add(n // i)

ans = 0
for x in factors:
    y = n // x
    if (x & y) == x:
        cnt = bin(x).count('1')
        ans += (1 << (cnt - 1)) if cnt > 0 else 0

print(ans)
0