結果
問題 | No.1286 Stone Skipping |
ユーザー | tails |
提出日時 | 2020-11-13 22:00:49 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 279 bytes |
コンパイル時間 | 344 ms |
コンパイル使用メモリ | 28,800 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 09:52:37 |
合計ジャッジ時間 | 1,113 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
コンパイルメッセージ
main.c:1:1: warning: return type defaults to 'int' [-Wimplicit-int] 1 | main(){ | ^~~~ main.c: In function 'main': main.c:3:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 3 | scanf("%ld",&d); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | main(){ main.c:3:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 3 | scanf("%ld",&d); | ^~~~~ main.c:3:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:18:33: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 18 | printf("%ld",m); | ^~~~~~ main.c:18:33: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:18:33: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:18:33: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:19:33: warning: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 19 | exit(0); | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | main(){ main.c:19:33: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 19 | exit(0); | ^~~~ main.c:19:33: note: include '<stdlib.h>' or provide a declaration of 'exit'
ソースコード
main(){ long d; scanf("%ld",&d); int k=63; while(1){ long l=0,r=1e18; while(l+1<r){ long m=l+r>>1; long x=0; for(int i=0;i<k;++i){ x+=m>>i; } if(x<d){ l=m; }else if(x>d){ r=m; }else{ printf("%ld",m); exit(0); } } --k; } }