結果
| 問題 |
No.47 ポケットを叩くとビスケットが2倍
|
| ユーザー |
|
| 提出日時 | 2022-11-12 22:00:29 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 315 bytes |
| コンパイル時間 | 4,020 ms |
| コンパイル使用メモリ | 118,272 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-14 10:29:33 |
| 合計ジャッジ時間 | 5,152 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int ans = 0;
int n = 0;
while (n < N) {
int b = 1;
while (b < N - n) {
b *= 2;
ans++;
}
if (b == N - n) break;
n += b - 1;
}
cout << ans << endl;
}