結果

問題 No.1452 XOR×OR
ユーザー NaHCO314
提出日時 2021-03-31 13:50:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 414 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 58,240 KB
最終ジャッジ日時 2024-07-02 15:38:43
合計ジャッジ時間 2,967 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
if n > 10 ** 9 or 1 > n:
    raise ValueError
x = 1
ans = 0

while x*x <= n:
    if n % x != 0:
        x += 1
        continue
    o = n // x
    cnt = 1
    for i in range(60):
        x_bit = (x >> i) & 1
        o_vit = (o >> i) & 1
        if x_bit == 1 and o_vit == 1:
            cnt *= 2
        if x_bit == 1 and o_vit == 0:
            cnt = 0
    ans += cnt
    x += 1

print(ans // 2)
0