結果
| 問題 |
No.642 Two Operations No.1
|
| コンテスト | |
| ユーザー |
nomi
|
| 提出日時 | 2018-02-02 21:29:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 812 bytes |
| コンパイル時間 | 1,700 ms |
| コンパイル使用メモリ | 166,540 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-31 07:10:50 |
| 合計ジャッジ時間 | 5,373 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
int cnt = 0;
while (1) {
if (x == n) {
break;
} else if (x < n) {
x *= 2;
} else if (x > n) {
x--;
}
cnt++;
}
cout << cnt << endl;
return 0;
}
nomi