結果

問題 No.680 作れる数
ユーザー tktk_snsn
提出日時 2021-01-30 13:26:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 52,096 KB
最終ジャッジ日時 2024-06-28 01:32:27
合計ジャッジ時間 1,727 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)


def F(t):
    res = 0
    while t:
        res += t
        t >>= 1
    return res


N = int(input())
l = 0
r = 10 ** 9
while r - l > 1:
    m = (r + l) // 2
    if F(m) > N:
        r = m
    else:
        l = m

if F(l) == N:
    print("YES")
else:
    print("NO")
0