結果
| 問題 |
No.47 ポケットを叩くとビスケットが2倍
|
| ユーザー |
|
| 提出日時 | 2021-01-09 22:59:07 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 450 bytes |
| コンパイル時間 | 808 ms |
| コンパイル使用メモリ | 73,936 KB |
| 最終ジャッジ日時 | 2025-01-17 15:52:32 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#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) {
++ans;
}
cout << ans << endl;
return 0;
}