結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー sekiya9311sekiya9311
提出日時 2016-10-19 15:37:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,318 ms / 5,000 ms
コード長 1,851 bytes
コンパイル時間 1,138 ms
コンパイル使用メモリ 116,672 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 23:46:06
合計ジャッジ時間 31,760 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,286 ms
6,816 KB
testcase_01 AC 2 ms
6,820 KB
testcase_02 AC 491 ms
6,944 KB
testcase_03 AC 930 ms
6,940 KB
testcase_04 AC 1,288 ms
6,944 KB
testcase_05 AC 1,282 ms
6,940 KB
testcase_06 AC 1,280 ms
6,940 KB
testcase_07 AC 1,281 ms
6,940 KB
testcase_08 AC 1,283 ms
6,940 KB
testcase_09 AC 1,295 ms
6,944 KB
testcase_10 AC 1,161 ms
6,940 KB
testcase_11 AC 1,232 ms
6,940 KB
testcase_12 AC 1,129 ms
6,944 KB
testcase_13 AC 1,195 ms
6,944 KB
testcase_14 AC 1,230 ms
6,940 KB
testcase_15 AC 1,096 ms
6,940 KB
testcase_16 AC 1,280 ms
6,944 KB
testcase_17 AC 1,281 ms
6,944 KB
testcase_18 AC 1,277 ms
6,944 KB
testcase_19 AC 1,273 ms
6,944 KB
testcase_20 AC 1,318 ms
6,940 KB
testcase_21 AC 1,304 ms
6,944 KB
testcase_22 AC 1,170 ms
6,944 KB
testcase_23 AC 1,226 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 26 ms
6,940 KB
testcase_26 AC 11 ms
6,944 KB
testcase_27 AC 8 ms
6,940 KB
testcase_28 AC 206 ms
6,944 KB
testcase_29 AC 105 ms
6,944 KB
testcase_30 AC 29 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <random>

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for (int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for (int (i) = (a) - 1; (i) >= (b); (i)--)
#define PI acos(-1.0)
#define DEBUG(C) cerr << C << endl;
#define VI vector <int>
#define VII vector <VI>
#define VL vector <LL>
#define VLL vector <VL>
#define VD vector <double>
#define VDD vector <VD>
#define PII pair <int, int>
#define PDD pair <double, double>
#define PLL pair <LL, LL>
#define VPII vector <PII>
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define EB emplace_back
#define FORE(a, b) for (auto &&a : b)
#define FIND(s, n) (s.find(n) != s.end())

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

LL N, K;
VL L;

bool check(double S) {
	LL cnt = 0;
	FORE(el, L) cnt += el / S;
	return cnt >= K;
}

int main(void) {
	cin >> N;
	L.resize(N);
	REP(i, N) scanf("%lld", &L[i]);
	cin >> K;
	double high = 1e11, low = 0.0;
	REP(_, 1000) {
		double mid = (high + low) / 2;
		//double mid = low + (high - low) / 2;
		(check(mid) ? low : high) = mid;
	}
	cout << fixed << setprecision(15) << low << endl;
}
0