結果

問題 No.2534 コラッツ数列
ユーザー detteiuu
提出日時 2024-10-25 20:57:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 278 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 82,576 KB
実行使用メモリ 53,548 KB
最終ジャッジ日時 2024-10-25 20:57:36
合計ジャッジ時間 2,905 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

ans = 1
while ans <= 50:
    if N == 1:
        ans += 1
        break
    else:
        ans += 1
        if N%2 == 0:
            N //= 2
        else:
            N = N*3+1
        ans += 1

if ans <= 50:
    print("Yes")
    print(ans)
else:
    print("No")
0