結果
| 問題 |
No.887 Collatz
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-23 12:56:27 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 259 bytes |
| コンパイル時間 | 158 ms |
| コンパイル使用メモリ | 81,944 KB |
| 実行使用メモリ | 53,896 KB |
| 最終ジャッジ日時 | 2024-09-22 08:28:26 |
| 合計ジャッジ時間 | 2,241 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 WA * 1 |
ソースコード
N = int(input())
if N == 1:
print(0)
print(4)
exit()
i1 = -1
nmax = N
i = 0
while i1 == -1:
if N % 2:
N = 3 * N + 1
else:
N = N // 2
if N == 1:
i1 = i
nmax = max(nmax, N)
i += 1
print(i1 + 1)
print(nmax)