結果

問題 No.2241 Reach 1
ユーザー _yurimoir_yurimoir
提出日時 2023-03-10 21:51:26
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 2,870 ms
コンパイル使用メモリ 244,116 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-18 04:08:06
合計ジャッジ時間 3,812 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
    int n;
    cin >> n;
    int ans = 0;
    while(n > 1){
        if(n % 2 == 0){
            while(n % 2 == 0){
                n /= 2;
            }
        }else{
            int idx = -1;
            for(int j = 1; j < 64; j++){
                if((n >> j) & 1){
                    idx = j;
                    break;
                }
            }
            n = ((1 << idx) - 1) * n + 1;
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}
0