結果
問題 |
No.47 ポケットを叩くとビスケットが2倍
|
ユーザー |
![]() |
提出日時 | 2018-03-29 21:42:09 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 562 bytes |
コンパイル時間 | 469 ms |
コンパイル使用メモリ | 28,928 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 23:53:51 |
合計ジャッジ時間 | 1,149 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.c: In function 'main': main.c:17:29: warning: implicit declaration of function 'pow' [-Wimplicit-function-declaration] 17 | while(n>=(int)pow(2,i)){ | ^~~ main.c:2:1: note: include '<math.h>' or provide a declaration of 'pow' 1 | #include <stdio.h> +++ |+#include <math.h> 2 | main.c:17:29: warning: incompatible implicit declaration of built-in function 'pow' [-Wbuiltin-declaration-mismatch] 17 | while(n>=(int)pow(2,i)){ | ^~~ main.c:17:29: note: include '<math.h>' or provide a declaration of 'pow' main.c:27:25: warning: incompatible implicit declaration of built-in function 'pow' [-Wbuiltin-declaration-mismatch] 27 | if(n-(int)pow(2,i-1)==0){ | ^~~ main.c:27:25: note: include '<math.h>' or provide a declaration of 'pow'
ソースコード
#include <stdio.h> int main(void) { // your code goes here int i=0, n; scanf("%d",&n); // printf("%d",(int)pow(2,n)); while(n>=(int)pow(2,i)){ i++; } // printf("%d",n-(int)pow(2,i-1)); if(n-(int)pow(2,i-1)==0){ printf("%d",i-1); }else{ printf("%d",i); } return 0; }