結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー fiordfiord
提出日時 2015-08-06 00:34:29
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 1,999 ms
コンパイル使用メモリ 145,668 KB
実行使用メモリ 8,768 KB
最終ジャッジ日時 2023-09-25 04:06:17
合計ジャッジ時間 11,737 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
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 <bits/stdc++.h>
using namespace std;
vector<int> l(200000);
int n;
long long int k;
bool check(double u){
	if(u==0)	return true;
	long long int cnt=0;
	for(int i=0;i<n;i++){
		cnt+=l[i]/u;
	}
	if(cnt>=k)	return true;
	else 	return false;
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++)	cin>>l[i];
	cin>>k;
	double l=0,r=1000000000;
	while(r-l>1e-9){
		if(check((l+r)/2))	l=(l+r)/2;
		else 	r=(l+r)/2;
		cout<<l<<" "<<r<<endl;
	}
	printf("%.15lf\n",(l+r)/2);
	return 0;
}
	
0