結果
| 問題 |
No.2534 コラッツ数列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-10 21:23:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 332 bytes |
| コンパイル時間 | 1,678 ms |
| コンパイル使用メモリ | 165,612 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-26 01:02:22 |
| 合計ジャッジ時間 | 2,319 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int n;cin>>n;
for(int i=0;i<25;++i)
{
if(n==1) {cout<<"Yes\n"<<2*i+2;return 0;}
if(n%2==0) n/=2;
else n=3*n+1;
}
cout<<"No";
return 0;
}