結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー tailstails
提出日時 2021-11-18 17:01:47
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 80 ms / 5,000 ms
コード長 445 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 32,384 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 01:21:11
合計ジャッジ時間 3,310 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 30 ms
6,940 KB
testcase_03 AC 57 ms
6,944 KB
testcase_04 AC 79 ms
6,944 KB
testcase_05 AC 79 ms
6,940 KB
testcase_06 AC 80 ms
6,940 KB
testcase_07 AC 78 ms
6,940 KB
testcase_08 AC 78 ms
6,944 KB
testcase_09 AC 77 ms
6,944 KB
testcase_10 AC 70 ms
6,944 KB
testcase_11 AC 75 ms
6,944 KB
testcase_12 AC 68 ms
6,944 KB
testcase_13 AC 71 ms
6,940 KB
testcase_14 AC 73 ms
6,944 KB
testcase_15 AC 67 ms
6,940 KB
testcase_16 AC 78 ms
6,944 KB
testcase_17 AC 79 ms
6,940 KB
testcase_18 AC 78 ms
6,940 KB
testcase_19 AC 78 ms
6,940 KB
testcase_20 AC 78 ms
6,944 KB
testcase_21 AC 78 ms
6,944 KB
testcase_22 AC 72 ms
6,940 KB
testcase_23 AC 74 ms
6,940 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 3 ms
6,940 KB
testcase_26 AC 2 ms
6,944 KB
testcase_27 AC 1 ms
6,944 KB
testcase_28 AC 13 ms
6,944 KB
testcase_29 AC 7 ms
6,940 KB
testcase_30 AC 3 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:11:1: warning: return type defaults to 'int' [-Wimplicit-int]
   11 | main(){
      | ^~~~
main.c: In function 'main':
main.c:30:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   30 |         printf("%.10f\n",z);
      |         ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | #pragma GCC optimize("Ofast")
main.c:30:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   30 |         printf("%.10f\n",z);
      |         ^~~~~~
main.c:30:9: note: include '<stdio.h>' or provide a declaration of 'printf'

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

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)

double 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(;d>=5e-10;d*=.5){
		double t=z+d;
		long c=0;
		rep(i,n){
			c+=l[i]/t;
		}
		if(c>=k){
			z=t;
		}
	}
	printf("%.10f\n",z);
}
0