結果

問題 No.680 作れる数
ユーザー H3PO4H3PO4
提出日時 2020-11-23 09:25:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 307 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,652 KB
実行使用メモリ 8,176 KB
最終ジャッジ日時 2023-09-30 23:39:53
合計ジャッジ時間 1,279 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,060 KB
testcase_01 AC 15 ms
7,876 KB
testcase_02 AC 17 ms
8,004 KB
testcase_03 AC 16 ms
7,976 KB
testcase_04 AC 16 ms
8,036 KB
testcase_05 AC 15 ms
7,792 KB
testcase_06 AC 15 ms
7,976 KB
testcase_07 AC 16 ms
7,888 KB
testcase_08 AC 15 ms
8,176 KB
testcase_09 AC 16 ms
8,128 KB
testcase_10 AC 16 ms
8,036 KB
testcase_11 AC 15 ms
8,076 KB
testcase_12 AC 16 ms
8,172 KB
testcase_13 AC 16 ms
7,728 KB
testcase_14 AC 16 ms
7,988 KB
testcase_15 AC 15 ms
7,764 KB
testcase_16 AC 16 ms
7,984 KB
testcase_17 AC 15 ms
7,752 KB
testcase_18 AC 16 ms
8,152 KB
testcase_19 AC 15 ms
7,728 KB
権限があれば一括ダウンロードができます

ソースコード

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