結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー syake_tasyake_ta
提出日時 2018-08-31 16:38:06
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 588 bytes
コンパイル時間 2,084 ms
コンパイル使用メモリ 67,336 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-11 22:50:44
合計ジャッジ時間 8,488 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 2 ms
4,352 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 3 ms
4,348 KB
testcase_26 AC 3 ms
4,348 KB
testcase_27 AC 2 ms
4,352 KB
testcase_28 RE -
testcase_29 AC 10 ms
4,348 KB
testcase_30 AC 4 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long ll;
typedef pair<int, int> P;
const int INF = (int)1e9 + 1;

ll n, l[20010], k;

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

	double low = 0.0;
	double high = 1e9;

	for (int t = 0; t < 100; t++) {
		double mid = (low + high) / 2;
		ll temp = 0;
		for (int i = 0; i < n; i++) {
			temp += (ll)(l[i] / mid);
		}

		if (temp >= k) low = mid;
		else high = mid;
	}
	cout << fixed << setprecision(10) << low << endl;
	return 0;
}
0