結果
問題 | No.47 ポケットを叩くとビスケットが2倍 |
ユーザー |
|
提出日時 | 2023-05-03 18:26:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 529 bytes |
コンパイル時間 | 1,633 ms |
コンパイル使用メモリ | 174,160 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-21 20:08:08 |
合計ジャッジ時間 | 2,507 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using Graph = vector<vector<int>>;int main() {long long N; cin >>N;long long x = 1;long long count = 0;map<int,int> dic;dic[1] = 0;for(int i = 0; i < 32; i++) {x *= 2;dic[x] = i + 1;}if(dic[N] > 0) {cout << dic[N] << endl;return 0;}if(N == 1) {cout << 0 << endl;return 0;}while(true) {N /= 2;count++;if(N == 0) {break;}}cout << count << endl;}