結果

問題 No.887 Collatz
ユーザー clearbook
提出日時 2019-10-23 18:12:34
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-06 15:27:07
合計ジャッジ時間 2,027 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

n0 = int(input())

n = [n0]
flag = True
for i in range(400):
    if n[i] == 1 and flag == True:
        num = i
        flag = False
        break
    
    if n[i] % 2 == 0:
        n.append(n[i] // 2)
    else:
        n.append(3*n[i] + 1)

print(num)
print(max(n))
0