結果
問題 | No.2241 Reach 1 |
ユーザー |
![]() |
提出日時 | 2025-03-31 17:34:45 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 705 bytes |
コンパイル時間 | 188 ms |
コンパイル使用メモリ | 82,324 KB |
実行使用メモリ | 54,384 KB |
最終ジャッジ日時 | 2025-03-31 17:35:29 |
合計ジャッジ時間 | 2,519 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 18 |
ソースコード
n = int(input())steps = 0while n != 1:if n % 2 == 0:# Divide by the maximum possible power of 2 in one stepwhile n % 2 == 0:n //= 2steps += 1else:found = False# Check up to s=40 which covers 2^40, sufficient for N up to 1e9for s in range(1, 40):power = (1 << s) - 1 # 2^s - 1if power % n == 0:steps += 2n = 1found = Truebreakif not found:# Use k=1 and then divide by 2 until oddn += 1cnt = 0while n % 2 == 0:n //= 2steps += 2print(steps)