結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー cielciel
提出日時 2014-11-17 00:04:57
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 450 bytes
コンパイル時間 1,799 ms
コンパイル使用メモリ 38,288 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-23 10:34:56
合計ジャッジ時間 6,122 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 38 ms
4,380 KB
testcase_03 AC 71 ms
4,376 KB
testcase_04 AC 96 ms
4,376 KB
testcase_05 AC 96 ms
4,380 KB
testcase_06 AC 96 ms
4,376 KB
testcase_07 AC 97 ms
4,376 KB
testcase_08 AC 98 ms
4,380 KB
testcase_09 AC 97 ms
4,376 KB
testcase_10 AC 86 ms
4,380 KB
testcase_11 AC 92 ms
4,376 KB
testcase_12 AC 83 ms
4,380 KB
testcase_13 AC 91 ms
4,380 KB
testcase_14 AC 93 ms
4,376 KB
testcase_15 AC 84 ms
4,376 KB
testcase_16 AC 96 ms
4,380 KB
testcase_17 AC 96 ms
4,376 KB
testcase_18 AC 96 ms
4,380 KB
testcase_19 AC 98 ms
4,376 KB
testcase_20 AC 97 ms
4,376 KB
testcase_21 AC 98 ms
4,380 KB
testcase_22 AC 86 ms
4,380 KB
testcase_23 AC 92 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 17 ms
4,380 KB
testcase_29 AC 10 ms
4,376 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <cstdio>
int main(){
	int n;
	long long k;
	double mi=0,ma=0;
	scanf("%d",&n);
	std::vector<double>v(n);
	for(int i=0;i<n;i++){
		scanf("%lf",&v[i]);
		if(ma<v[i])ma=v[i];
	}
	scanf("%lld",&k);
	//for(;mi+1e-9<ma;){
	for(int x=0;x<50;x++){
		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("%.14f\n",mi);
}
0