結果

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

ソースコード

diff #

#!/usr/bin/env python3
import sys


def main():
    N = int(input())
    # A, B = map(int,input().split())
    def getDivisors(n: int):
        divisors = []
        i = 1
        while i * i <= n:
            if n % i == 0:
                divisors.append([i])
                divisors[-1].append(n//i)
            i += 1
        return divisors
    ans = 0
    for a, b in getDivisors(N):
        c = 1
        for i in range(max(len(bin(a)[2:]), len(bin(b)[2:]))):
            bit = (a >> i & 1, b >> i & 1)
            if bit == (1, 1):
                c *= 2
            elif bit == (1, 0):
                break
        else:
            ans += c
    print(ans // 2)

    return

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