結果
| 問題 |
No.2241 Reach 1
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 01:06:26 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 2,000 ms |
| コード長 | 330 bytes |
| コンパイル時間 | 144 ms |
| コンパイル使用メモリ | 81,232 KB |
| 実行使用メモリ | 53,560 KB |
| 最終ジャッジ日時 | 2025-04-16 01:08:07 |
| 合計ジャッジ時間 | 2,263 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
n = int(input())
cnt = 0
# Divide by the maximum possible power of 2 each time
while n % 2 == 0:
lsb = n & -n # Find the least significant bit (max power of 2 dividing n)
n //= lsb
cnt += 1
# If the remaining n is greater than 1, add 2 operations (multiply and add 1, then divide)
if n > 1:
cnt += 2
print(cnt)
lam6er