結果
問題 | 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 syssys.setrecursionlimit(5*10**5)input = sys.stdin.readlinefrom collections import defaultdict, deque, Counterfrom heapq import heappop, heappushfrom bisect import bisect_left, bisect_rightfrom math import gcdn = int(input())ans = []cnt = 1while cnt < 50:if n == 1:cnt += 1print('Yes')print(cnt)exit()else:if n % 2 == 0:n //= 2cnt += 2else:n = 3*n+1cnt += 2print('No')