結果
| 問題 | No.47 ポケットを叩くとビスケットが2倍 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-09 22:54:46 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 520 bytes |
| 記録 | |
| コンパイル時間 | 442 ms |
| コンパイル使用メモリ | 92,276 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-16 14:43:10 |
| 合計ジャッジ時間 | 1,600 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 7 |
ソースコード
#include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <optional>
#include <vector>
using namespace std;
int main() {
int32_t n;
cin >> n;
int32_t ans = 0;
for (auto i = 0; i < 31; ++i) {
if ((1 << (i + 1)) > n) {
ans = i;
n -= 1 << i;
break;
}
}
if (n == 0)
;
else if (n == 1)
ans += 1;
else
ans += n % 2 == 0 ? 1 : 2;
cout << ans << endl;
return 0;
}