結果
問題 | No.47 ポケットを叩くとビスケットが2倍 |
ユーザー |
![]() |
提出日時 | 2016-12-26 16:37:23 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 457 ms |
コンパイル使用メモリ | 58,716 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-15 00:09:15 |
合計ジャッジ時間 | 1,230 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <iostream> #include <math.h> using namespace std; int main(){ long long int N; cin >> N; int i=0; while((N-pow(2,(i+1)))>=0){ i=i+1; } // cout << N-(long long int)pow(2,i) <<endl; // cout << (int)pow(2,i)<<endl; // cout << i << endl; if((N-(long long int)pow(2,i))==0){ // cout <<" a" << endl; cout << i <<endl; } else if((N-(long long int)pow(2,i))==1){ // cout <<" b" << endl; cout << i+1 <<endl; } else{ // cout <<" c" << endl; cout << i+1 << endl; } return 0; }