結果
| 問題 |
No.887 Collatz
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 18:39:53 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 2,000 ms |
| コード長 | 300 bytes |
| コンパイル時間 | 262 ms |
| コンパイル使用メモリ | 82,336 KB |
| 実行使用メモリ | 53,588 KB |
| 最終ジャッジ日時 | 2025-03-20 18:39:57 |
| 合計ジャッジ時間 | 2,197 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
n = int(input())
current = n
max_val = current
steps = 0
while current != 1:
if current % 2 == 0:
next_val = current // 2
else:
next_val = 3 * current + 1
if next_val > max_val:
max_val = next_val
steps += 1
current = next_val
print(steps)
print(max_val)
lam6er