結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー nemakura3nemakura3
提出日時 2019-08-03 17:48:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 241 ms / 5,000 ms
コード長 848 bytes
コンパイル時間 1,713 ms
コンパイル使用メモリ 166,736 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 00:45:21
合計ジャッジ時間 8,092 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 241 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 89 ms
6,940 KB
testcase_03 AC 169 ms
6,940 KB
testcase_04 AC 213 ms
6,944 KB
testcase_05 AC 212 ms
6,944 KB
testcase_06 AC 212 ms
6,944 KB
testcase_07 AC 234 ms
6,940 KB
testcase_08 AC 233 ms
6,944 KB
testcase_09 AC 234 ms
6,940 KB
testcase_10 AC 192 ms
6,940 KB
testcase_11 AC 202 ms
6,944 KB
testcase_12 AC 184 ms
6,944 KB
testcase_13 AC 214 ms
6,944 KB
testcase_14 AC 222 ms
6,940 KB
testcase_15 AC 199 ms
6,940 KB
testcase_16 AC 212 ms
6,940 KB
testcase_17 AC 211 ms
6,940 KB
testcase_18 AC 213 ms
6,940 KB
testcase_19 AC 233 ms
6,940 KB
testcase_20 AC 233 ms
6,940 KB
testcase_21 AC 235 ms
6,940 KB
testcase_22 AC 191 ms
6,944 KB
testcase_23 AC 201 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,940 KB
testcase_27 AC 3 ms
6,944 KB
testcase_28 AC 39 ms
6,940 KB
testcase_29 AC 20 ms
6,940 KB
testcase_30 AC 6 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()
#define rep(i,from,to) for (int (i) = (from); (i) < (to); ++(i))
#define repi(x) for (int i = 0; i < (x); ++i)
#define repj(x) for (int j = 0; j < (x); ++j)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


int main() {
	ll N;
	cin >> N;
	vector<double> L(N);
	repi(N) cin >> L[i];
	ll K;
	cin >> K;

	double l = 0, r = 1e10;
	double mid = 0;
	rep(i,0,100) {
		mid = (r + l) / 2;
		ll a = 0;
		for (int j = 0; j < N; ++j) {
			a += L[j] / mid;
		}
		if (a >= K) l = mid;
		else r = mid;
	}
	cout << fixed << setprecision(10) << mid << endl;
	return 0;
}
0