結果

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

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    ans = 0
    for a in range(1, N+1):
        if a * a > N:
            break
        if N%a == 0:
            b = N // a
            cnt = 1
            for i in range(31):
                ai = a >> i & 1
                bi = b >> i & 1
                if ai == 1 and bi == 1:
                    cnt *= 2
                elif ai == 1 and bi == 0:
                    cnt *= 0
            if cnt > 1:
                cnt //= 2
            ans += cnt
    print(ans)


if __name__ == '__main__':
    main()
0