結果
| 問題 | 
                            No.642 Two Operations No.1
                             | 
                    
| コンテスト | |
| ユーザー | 
                             focus
                         | 
                    
| 提出日時 | 2018-02-28 19:21:33 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 304 bytes | 
| コンパイル時間 | 657 ms | 
| コンパイル使用メモリ | 73,400 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-21 14:43:58 | 
| 合計ジャッジ時間 | 1,342 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 15 | 
ソースコード
#include<iostream>
#include<vector>
#include<bitset>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
int main(){ 
    long long N;
    int ans;
    cin >> N;
    for(ans=0;N!=1;ans++){
        if(N%2==0)  N/=2;
        else    N++;
    }
    cout << ans << endl;
    return 0;
}
            
            
            
        
            
focus