結果

問題 No.2241 Reach 1
ユーザー FromBooskaFromBooska
提出日時 2023-05-01 11:13:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 397 bytes
コンパイル時間 417 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 71,620 KB
最終ジャッジ日時 2023-08-12 20:02:07
合計ジャッジ時間 4,671 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,496 KB
testcase_01 AC 68 ms
71,312 KB
testcase_02 AC 70 ms
71,300 KB
testcase_03 AC 69 ms
71,312 KB
testcase_04 AC 69 ms
71,008 KB
testcase_05 AC 69 ms
71,012 KB
testcase_06 AC 69 ms
71,312 KB
testcase_07 AC 68 ms
71,392 KB
testcase_08 AC 69 ms
71,132 KB
testcase_09 AC 69 ms
71,396 KB
testcase_10 AC 71 ms
71,216 KB
testcase_11 AC 70 ms
71,396 KB
testcase_12 AC 68 ms
71,496 KB
testcase_13 AC 70 ms
70,980 KB
testcase_14 AC 71 ms
71,344 KB
testcase_15 AC 69 ms
71,444 KB
testcase_16 AC 69 ms
71,188 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
m = N
count = 0
if m%2 == 0:
    count += 1
    while m%2 == 0:
        m //= 2
#print(m, count)

if m == 1:
    print(count)
    exit()

mn_gap = 10**20
for d in range(1, 32):
    power = pow(2, d)
    k = (power-1)//m
    if k > 0:
        gap = power - (k*m+1)
        mn_gap = min(mn_gap, gap)
        #print('d', d, 'mn_gap', mn_gap, gap, k)

count += mn_gap +2
print(count)
0