結果

問題 No.887 Collatz
ユーザー d_sei
提出日時 2019-10-13 19:00:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 429 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-16 07:18:36
合計ジャッジ時間 1,903 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include <vector>
#include<cmath>
#include<iomanip>
#include<queue>
using namespace std;
typedef long long int lint;
int main() {
	lint n0;
	cin >> n0;
	vector<lint>vec(1000);
	int cnt = 0;
	while (n0 > 1) {
		vec.at(cnt) = n0;
		if (n0 % 2) {
			n0 = 3 * n0 + 1;
		}
		else {
			n0 = n0/2;
		}
		cnt++;
	}
	sort(vec.begin(), vec.end());
	cout << cnt << endl << vec.at(999) << endl;
}



	
0