結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー mannshi222jp
提出日時 2022-01-29 20:03:59
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 243 bytes
コンパイル時間 589 ms
コンパイル使用メモリ 24,704 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-01-02 15:12:00
合計ジャッジ時間 1,265 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:18: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘long int *’ [-Wformat=]
    6 |         scanf( "%d\n", &N );
      |                 ~^     ~~
      |                  |     |
      |                  int * long int *
      |                 %ld
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf( "%d\n", &N );
      |         ^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main()
{
        long N;
        scanf( "%d\n", &N );

        long c  = 1;
        int cnt = 0;
        for( ;  c <= N ; c = c * 2 ) {
                cnt++;
        }

        printf("%d\n", cnt );
        return 0;
}
0