結果
問題 | No.47 ポケットを叩くとビスケットが2倍 |
ユーザー |
|
提出日時 | 2017-12-08 23:04:34 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 414 bytes |
コンパイル時間 | 586 ms |
コンパイル使用メモリ | 59,100 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-29 19:54:03 |
合計ジャッジ時間 | 9,832 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 10 |
ソースコード
#include <iostream> #include <cmath> using namespace std; int main(){ int n; cin >> n; if(n == 1) cout << "0" << endl; else if(n%2 == 1) cout << (2*n + 1)/2 -1 << endl; else if(n == 2) cout << "1" << endl; else if(n == 4) cout << "2" << endl; else { for(int i = 1; i < n; i++){ if(pow(2,i) <= n && n <= pow(2,i+1))cout << i + 1 << endl; } } return 0; }