結果

問題 No.887 Collatz
ユーザー aeronex806
提出日時 2019-09-24 02:34:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 210 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-19 04:51:35
合計ジャッジ時間 1,860 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 10 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

n0=int(input())
nmax=n0
n=n0
cnt=0
while n!=1:
    if n==1:
        break
    elif n%2==0:
        n/=2
        cnt+=1
    elif n%2==1:
        n=3*n+1
        cnt+=1
    nmax=max(nmax,n)
print(cnt)
print(nmax)
0