結果
| 問題 | No.887 Collatz |
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 18:39:53 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 300 bytes |
| 記録 | |
| コンパイル時間 | 241 ms |
| コンパイル使用メモリ | 95,856 KB |
| 実行使用メモリ | 79,360 KB |
| 最終ジャッジ日時 | 2026-07-07 07:13:26 |
| 合計ジャッジ時間 | 3,889 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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