結果

問題 No.887 Collatz
ユーザー otsuneko
提出日時 2021-05-07 21:05:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 241 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 81,984 KB
実行使用メモリ 53,172 KB
最終ジャッジ日時 2024-09-15 08:48:06
合計ジャッジ時間 2,471 ms
ジャッジサーバーID
(参考情報)
judge6 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

n0 = int(input())
cnt = 1
max_n = n0
while 1:
    n_i = n0//2 if n0%2 == 0 else 3*n0+1
    if n_i == 1:
        print(cnt)
        print(max_n)
        break
    else:
        n0 = n_i
        max_n = max(max_n,n0)
    cnt += 1
0