結果
問題 | No.2534 コラッツ数列 |
ユーザー |
![]() |
提出日時 | 2023-11-13 14:03:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 640 bytes |
コンパイル時間 | 4,126 ms |
コンパイル使用メモリ | 250,924 KB |
最終ジャッジ日時 | 2025-02-17 21:53:57 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
#include <bits/stdc++.h>#include<atcoder/all>using namespace atcoder;using namespace std;using ll=long long;using ld=long double;ld pie=3.141592653589793;ll mod=998244353;ll inf=30000000000000000;//10^17int main(){ll n;cin >> n;for (ll i = 0; i < 50; i++){if (n==1){cout << "Yes" << endl;cout << (i+1)*2 << endl;return 0;}if ((i+1)*2>=50){cout << "No" << endl;return 0;}if (n%2==0){n/=2;}else{n*=3;n+=1;}}}