結果

問題 No.887 Collatz
ユーザー hase_0o0
提出日時 2019-10-26 00:38:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 239 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 82,004 KB
実行使用メモリ 53,860 KB
最終ジャッジ日時 2024-09-13 11:38:10
合計ジャッジ時間 2,671 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())

if n==1:
    print(0)
    print(4)
    exit()
if n==2:
    print(1)
    print(4)
    exit()


ans=n
i=0
while n!=1:
    if n%2==0:
        n//=2
    else:
        n=3*n+1
        ans=max(ans,n)
    i+=1
print(i)
print(ans)
0