結果

問題 No.2534 コラッツ数列
ユーザー daiota
提出日時 2023-11-11 00:46:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 1,455 ms
コンパイル使用メモリ 167,056 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-26 02:30:27
合計ジャッジ時間 2,338 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define REP(i,n) for(int i=0;i<int(n);i++)



int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	int i,j,k;

	int N;
	cin >> N;

	int n=N;
	int ans=1;
	while(1){
		if(n==1){
			ans++;
			break;
		}
		else if(n%2==0){
			n/=2;
			ans+=2;
		}
		else{
			n=3*N+1;
			ans+=2;
		}

		if(ans>50) break;

	}


	if(ans<=50){
		cout << "Yes" << endl;
		cout << ans << endl;
	}else{
		cout << "No" << endl;
	}


	return 0;
}
0