結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー cielciel
提出日時 2014-11-16 23:36:58
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 399 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 38,480 KB
実行使用メモリ 42,856 KB
最終ジャッジ日時 2023-08-30 07:38:04
合計ジャッジ時間 9,207 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 43 ms
4,376 KB
testcase_03 AC 80 ms
4,376 KB
testcase_04 AC 110 ms
4,376 KB
testcase_05 AC 109 ms
4,376 KB
testcase_06 AC 109 ms
4,376 KB
testcase_07 AC 110 ms
4,376 KB
testcase_08 AC 110 ms
4,380 KB
testcase_09 AC 111 ms
4,380 KB
testcase_10 AC 99 ms
4,376 KB
testcase_11 AC 103 ms
4,376 KB
testcase_12 AC 95 ms
4,380 KB
testcase_13 AC 102 ms
4,376 KB
testcase_14 AC 105 ms
4,380 KB
testcase_15 AC 94 ms
4,376 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <cstdio>
int main(){
	int n;
	long long k;
	scanf("%d",&n);
	std::vector<double>v(n);
	for(int i=0;i<n;i++){
		scanf("%lf",&v[i]);
	}
	scanf("%lld",&k);
	double mi=0,ma=1e9;
	for(;mi+1e-9<ma;){
		long long _n=0;
		double h=(mi+ma)/2;
		for(int i=0;i<n;i++){
			_n+=v[i]/h;
		}
		if(_n>=k){
			mi=h;
		}else{
			ma=h;
		}
	}
	printf("%.9f\n",mi);
}
0