結果
| 問題 | 
                            No.642 Two Operations No.1
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nomi
                         | 
                    
| 提出日時 | 2018-02-02 22:11:14 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 785 bytes | 
| コンパイル時間 | 1,636 ms | 
| コンパイル使用メモリ | 165,964 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-12-31 07:38:50 | 
| 合計ジャッジ時間 | 4,447 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 WA * 9 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
int main() {
   ll n;
   cin >> n;
   ll x = 1;
   ll cnt = 0;
   while (1) {
      if (x == n) break;
      if (x*2-1 > n) {
         x--;
      } else {
         x*=2;
      }
      cnt++;
   }
   cout << cnt << endl;
   return 0;
}
            
            
            
        
            
nomi