結果

問題 No.680 作れる数
ユーザー H3PO4
提出日時 2020-11-23 09:25:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 307 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-23 17:21:03
合計ジャッジ時間 1,576 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(N):
    if N == 1: return 1
    return N + f(N // 2)


def possible(flag):
    if flag: print('YES');exit()


N = int(input())
possible(N == 0)
# bisect
l, r = 0, 10 ** 9
while r - l > 1:
    m = (r + l) // 2
    possible(f(m) == N)

    if f(m) > N:
        r = m
    else:
        l = m
print('NO')
0