結果

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

ソースコード

diff #

n0 = int(input())

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

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