結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー fiordfiord
提出日時 2015-08-06 00:36:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 212 ms / 5,000 ms
コード長 461 bytes
コンパイル時間 1,262 ms
コンパイル使用メモリ 159,776 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 23:28:35
合計ジャッジ時間 6,999 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 212 ms
6,812 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 AC 78 ms
6,944 KB
testcase_03 AC 152 ms
6,940 KB
testcase_04 AC 179 ms
6,940 KB
testcase_05 AC 180 ms
6,944 KB
testcase_06 AC 179 ms
6,944 KB
testcase_07 AC 202 ms
6,940 KB
testcase_08 AC 200 ms
6,940 KB
testcase_09 AC 204 ms
6,940 KB
testcase_10 AC 165 ms
6,944 KB
testcase_11 AC 172 ms
6,944 KB
testcase_12 AC 160 ms
6,940 KB
testcase_13 AC 185 ms
6,940 KB
testcase_14 AC 198 ms
6,944 KB
testcase_15 AC 179 ms
6,940 KB
testcase_16 AC 187 ms
6,940 KB
testcase_17 AC 189 ms
6,940 KB
testcase_18 AC 182 ms
6,944 KB
testcase_19 AC 202 ms
6,940 KB
testcase_20 AC 200 ms
6,940 KB
testcase_21 AC 203 ms
6,944 KB
testcase_22 AC 165 ms
6,940 KB
testcase_23 AC 170 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 6 ms
6,944 KB
testcase_26 AC 3 ms
6,944 KB
testcase_27 AC 3 ms
6,944 KB
testcase_28 AC 33 ms
6,944 KB
testcase_29 AC 17 ms
6,940 KB
testcase_30 AC 6 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

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;
	for(int i=0;i<100;i++){
		if(check((l+r)/2))	l=(l+r)/2;
		else 	r=(l+r)/2;
	}
	printf("%.15lf\n",(l+r)/2);
	return 0;
}
	
0