結果
| 問題 | 
                            No.642 Two Operations No.1
                             | 
                    
| コンテスト | |
| ユーザー | 
                             pin
                         | 
                    
| 提出日時 | 2018-02-03 19:45:30 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 456 bytes | 
| コンパイル時間 | 936 ms | 
| コンパイル使用メモリ | 80,796 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-11 17:47:01 | 
| 合計ジャッジ時間 | 1,355 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 15 | 
ソースコード
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const int INF = 10000000;
ll n;
int main(void){
    cin >> n;
    int ans = 0;
    while (n > 1){
        if (n % 2 == 1) n += 1;
        else n /= 2;
        ans++;
    }
    cout << ans << endl;
}
            
            
            
        
            
pin