結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー NoiriNoiri
提出日時 2017-12-08 23:04:34
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 595 ms
コンパイル使用メモリ 59,260 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-07 05:45:16
合計ジャッジ時間 9,546 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1,634 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1,259 ms
6,940 KB
testcase_11 AC 584 ms
6,940 KB
testcase_12 AC 689 ms
6,940 KB
testcase_13 AC 766 ms
6,940 KB
testcase_14 AC 1,474 ms
6,940 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 804 ms
6,940 KB
testcase_18 AC 196 ms
6,940 KB
testcase_19 AC 55 ms
6,940 KB
testcase_20 AC 866 ms
6,940 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0