結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー cielciel
提出日時 2014-11-16 23:33:26
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 401 bytes
コンパイル時間 623 ms
コンパイル使用メモリ 38,020 KB
実行使用メモリ 8,712 KB
最終ジャッジ日時 2023-08-30 07:33:49
合計ジャッジ時間 9,430 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 45 ms
4,376 KB
testcase_03 AC 84 ms
4,376 KB
testcase_04 AC 115 ms
4,376 KB
testcase_05 AC 115 ms
4,380 KB
testcase_06 AC 114 ms
4,380 KB
testcase_07 AC 116 ms
4,380 KB
testcase_08 AC 116 ms
4,380 KB
testcase_09 AC 115 ms
4,380 KB
testcase_10 AC 104 ms
4,384 KB
testcase_11 AC 109 ms
4,380 KB
testcase_12 AC 98 ms
4,376 KB
testcase_13 AC 106 ms
4,376 KB
testcase_14 AC 110 ms
4,380 KB
testcase_15 AC 96 ms
4,380 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-10<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("%.10f\n",mi);
}
0