結果

問題 No.887 Collatz
ユーザー mojamojam
提出日時 2020-12-25 02:59:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 218 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-21 17:28:48
合計ジャッジ時間 2,373 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

first_n = int(input())
n = first_n
i = 0
max_n = first_n
while (not n==1):
    i += 1
    if (n % 2):
        n = 3*n + 1
    else:
        n = n/2

    if n > max_n:
        max_n = n

print(i)
print(int(max_n))    

0