結果

問題 No.2241 Reach 1
ユーザー HIcoder
提出日時 2023-07-11 15:33:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 797 bytes
コンパイル時間 849 ms
コンパイル使用メモリ 96,768 KB
最終ジャッジ日時 2025-02-15 09:48:32
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<set>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;
const ll INF=1LL<<60;
typedef pair<int,int> P;
typedef pair<int,P> PP;
const ll MOD=998244353;
const double PI=acos(-1);

int main(){
    int N;
    cin>>N;

    int ans=0;

    while(1){

        if(N%2==0){
            ans++;
            while(N%2==0){
                N/=2;
            }
        }else{

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

    cout<<ans<<endl;
}
0