結果
問題 |
No.47 ポケットを叩くとビスケットが2倍
|
ユーザー |
![]() |
提出日時 | 2019-02-26 15:10:28 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 543 bytes |
コンパイル時間 | 1,100 ms |
コンパイル使用メモリ | 138,828 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-30 13:38:47 |
合計ジャッジ時間 | 1,858 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 8 |
ソースコード
#include <algorithm> #include <iostream> #include <iomanip> #include <cstring> #include <string> #include <vector> #include <queue> #include <cmath> #include <stack> #include <set> #include <map> typedef long long ll; typedef unsigned int uint; using namespace std; int n; int ans = 0; void solve(int num) { int bis = 1; while (num >= bis * 2 ) { bis *= 2; ans++; } if (num - bis == 0) return ; else { ans++; return ; } } int main() { cin >> n; if (n % 2 == 1) { ans++; n -= 1; } solve(n); cout << ans << endl; }