結果

問題 No.642 Two Operations No.1
ユーザー aaaaaaiuaaaaaaiu
提出日時 2019-08-19 19:08:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 1,920 ms
コンパイル使用メモリ 192,792 KB
最終ジャッジ日時 2025-01-07 14:17:44
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin>>n;
    int ans=0;
    while (n>1) {
        if (n&1) {
            n++;
            ans++;
        }
        n/=2;
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}
0