結果
| 問題 | No.642 Two Operations No.1 |
| コンテスト | |
| ユーザー |
kichirb3
|
| 提出日時 | 2018-03-07 08:12:48 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 464 bytes |
| 記録 | |
| コンパイル時間 | 332 ms |
| コンパイル使用メモリ | 73,312 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-11 17:53:44 |
| 合計ジャッジ時間 | 1,266 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
ソースコード
// No.642 Two Operations No.1
// https://yukicoder.me/problems/no/642a
//
#include <iostream>
using namespace std;
int solve(int N);
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int N;
cin >> N;
int ans = solve(N);
cout << ans << endl;
}
int solve(int N) {
int ans = 0;
while (N != 1) {
if (N % 2 == 0)
N /= 2;
else
++N;
++ans;
}
return ans;
}
kichirb3