結果
| 問題 |
No.2534 コラッツ数列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-10 21:44:38 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 360 bytes |
| コンパイル時間 | 193 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 52,352 KB |
| 最終ジャッジ日時 | 2024-09-26 01:20:29 |
| 合計ジャッジ時間 | 2,739 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 16 |
ソースコード
def P(n):
cnt = 0
nn = n
cnt+=1
while nn!=1 and cnt<=50:
cnt+=1
if nn%2==0:
nn//=2
cnt+=1
else:
nn=3*nn+1
cnt+1
cnt+=1
return cnt
import sys
input = sys.stdin.readline
N = int(input())
cnt = P(N)
if cnt<=50:
print("Yes")
print(cnt)
else:
print("No")