結果

問題 No.2534 コラッツ数列
ユーザー Kira Yoshikage
提出日時 2023-11-10 23:13:55
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 1,910 ms
コンパイル使用メモリ 166,016 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-26 02:13:43
合計ジャッジ時間 2,432 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define int long long

int32_t main() {
    cin.tie(0)->sync_with_stdio(0);
    int n; cin >> n;
    for (int i = 0; ; ++i) {
        if (i == 50) {
            cout << "No";
            return 0;
        }

        if (n == 1) {
            cout << "Yes\n" << (i + 1) * 2 << '\n';
            return 0;
        }
        if (n % 2) n = n * 3 + 1;
        else n /= 2;
    }
}
0