結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー kotatsugamekotatsugame
提出日時 2016-12-03 02:59:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 238 ms / 5,000 ms
コード長 456 bytes
コンパイル時間 795 ms
コンパイル使用メモリ 73,420 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 23:45:10
合計ジャッジ時間 6,944 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 238 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 88 ms
6,940 KB
testcase_03 AC 168 ms
6,940 KB
testcase_04 AC 213 ms
6,940 KB
testcase_05 AC 212 ms
6,944 KB
testcase_06 AC 213 ms
6,944 KB
testcase_07 AC 229 ms
6,944 KB
testcase_08 AC 231 ms
6,940 KB
testcase_09 AC 231 ms
6,940 KB
testcase_10 AC 187 ms
6,940 KB
testcase_11 AC 200 ms
6,944 KB
testcase_12 AC 181 ms
6,940 KB
testcase_13 AC 211 ms
6,940 KB
testcase_14 AC 222 ms
6,944 KB
testcase_15 AC 195 ms
6,940 KB
testcase_16 AC 212 ms
6,940 KB
testcase_17 AC 210 ms
6,944 KB
testcase_18 AC 207 ms
6,944 KB
testcase_19 AC 232 ms
6,940 KB
testcase_20 AC 232 ms
6,944 KB
testcase_21 AC 232 ms
6,940 KB
testcase_22 AC 191 ms
6,944 KB
testcase_23 AC 202 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 6 ms
6,940 KB
testcase_26 AC 4 ms
6,940 KB
testcase_27 AC 3 ms
6,944 KB
testcase_28 AC 39 ms
6,940 KB
testcase_29 AC 21 ms
6,940 KB
testcase_30 AC 6 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;

long long int n,k;
double l[1<<18];

bool c(double d)
{
	long long int ans=0;
	for(int i=0;i<n;i++)
	{
		ans+=(int)l[i]/d;
	}
	return ans>=k;
}

int main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>l[i];
	cin>>k;

	double a=0.0,b=(double)1e9;

	for(int i=0;i<100;i++)
	{
		double mid=(a+b)/2;
		if(c(mid))a=mid;
		else b=mid;
	}
	cout<<fixed<<setprecision(9)<<a<<endl;
	return 0;
}
0