結果

問題 No.2241 Reach 1
ユーザー HIcoder
提出日時 2023-07-11 15:17:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 645 bytes
コンパイル時間 996 ms
コンパイル使用メモリ 95,500 KB
最終ジャッジ日時 2025-02-15 09:48:05
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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==1){
            break;
        }
        if(N%2==0){
            ans++;
            while(N%2==0){
                N/=2;
            }
        }else{
            ans++;
            N+=1;
        }
    }

    cout<<ans<<endl;
}
0