結果
| 問題 | No.2534 コラッツ数列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-10 21:28:14 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 2,000 ms |
| コード長 | 503 bytes |
| コンパイル時間 | 289 ms |
| コンパイル使用メモリ | 81,864 KB |
| 実行使用メモリ | 54,656 KB |
| 最終ジャッジ日時 | 2024-09-26 01:06:36 |
| 合計ジャッジ時間 | 2,606 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
ソースコード
import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd
n = int(input())
ans = []
cnt = 1
while cnt < 50:
if n == 1:
cnt += 1
print('Yes')
print(cnt)
exit()
else:
if n % 2 == 0:
n //= 2
cnt += 2
else:
n = 3*n+1
cnt += 2
print('No')