結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー tailstails
提出日時 2021-11-18 17:17:49
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 400 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 31,232 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 01:22:14
合計ジャッジ時間 2,914 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 26 ms
6,944 KB
testcase_03 AC 49 ms
6,940 KB
testcase_04 AC 74 ms
6,944 KB
testcase_05 AC 74 ms
6,944 KB
testcase_06 AC 65 ms
6,944 KB
testcase_07 AC 68 ms
6,944 KB
testcase_08 AC 68 ms
6,948 KB
testcase_09 AC 60 ms
6,940 KB
testcase_10 AC 67 ms
6,940 KB
testcase_11 AC 70 ms
6,944 KB
testcase_12 AC 55 ms
6,944 KB
testcase_13 AC 61 ms
6,944 KB
testcase_14 AC 64 ms
6,944 KB
testcase_15 AC 51 ms
6,940 KB
testcase_16 AC 52 ms
6,944 KB
testcase_17 AC 49 ms
6,940 KB
testcase_18 AC 48 ms
6,944 KB
testcase_19 AC 47 ms
6,944 KB
testcase_20 AC 47 ms
6,944 KB
testcase_21 AC 47 ms
6,944 KB
testcase_22 AC 44 ms
6,940 KB
testcase_23 AC 46 ms
6,940 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 3 ms
6,944 KB
testcase_26 AC 1 ms
6,940 KB
testcase_27 AC 1 ms
6,944 KB
testcase_28 AC 12 ms
6,944 KB
testcase_29 AC 7 ms
6,940 KB
testcase_30 AC 3 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:8:1: warning: return type defaults to 'int' [-Wimplicit-int]
    8 | main(){
      | ^~~~
main.c: In function 'main':
main.c:28:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   28 |         printf("%.10f\n",z);
      |         ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | char*mmap();
main.c:28:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   28 |         printf("%.10f\n",z);
      |         ^~~~~~
main.c:28:9: note: include '<stdio.h>' or provide a declaration of 'printf'

ソースコード

diff #

char*mmap();

#define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
#define rep(v,e) for(long v=0;v<e;++v)

int l[200000];

main(){
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	rd(n);
	rep(i,n){
		rd(li);
		l[i]=li;
	}
	rd(k);
	double z=0,d=1e9;
	for(;z<d*1e10;d*=.5){
		double t=z+d;
		double v=1/t;
		long c=0;
		rep(i,n){
			c+=l[i]*v;
		}
		if(c>=k){
			z=t;
		}
	}
	printf("%.10f\n",z);
}
0