結果
| 問題 | 
                            No.2534 コラッツ数列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nonon
                         | 
                    
| 提出日時 | 2023-11-10 21:28:05 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 514 bytes | 
| コンパイル時間 | 1,792 ms | 
| コンパイル使用メモリ | 193,336 KB | 
| 最終ジャッジ日時 | 2025-02-17 20:25:09 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 33 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    long long N;
    cin>>N;
    int ans=0;
    while(ans<=50){
        ans++;
        if(N==1){
            ans++;
            if(ans<=50){
	            cout<<"Yes\n";
	            cout<<ans<<endl;
	            return 0;
            }
        }
        if(N%2==0){
            ans++;
            N/=2;
        }
        else{
            ans++;
            N=3*N+1;
        }
    }
    cout<<"No\n";
}
            
            
            
        
            
nonon