結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー kai10920
提出日時 2023-01-25 17:43:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 228 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 26,836 KB
最終ジャッジ日時 2025-02-10 06:46:22
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~

ソースコード

diff #

#include<stdio.h>

int main(){
    int n;
    scanf("%d",&n);
    int cookie=1;
    int count=0;
    while(n>cookie*2){
        cookie*=2;
        count++;
    }
    if(n>cookie){
        count++;
    }
    printf("%d",count);
}
0