結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー kurenaifkurenaif
提出日時 2016-02-18 21:34:31
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,631 bytes
コンパイル時間 1,068 ms
コンパイル使用メモリ 84,688 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-23 18:10:34
合計ジャッジ時間 67,924 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <limits>
#include <cmath>
#include <cstdio>
#include <iomanip>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define inf INT_MAX/3
#define INF INT_MAX/3
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out printf
#define LL long long
#define ULL unsigned long long
#define eps 1e-14
#define FST first
#define SEC second

int N;
vector<int> L;
int K;

bool check(double length) {
	int cnt = 0;
	for (int i = 0; i < L.size(); ++i) {
		cnt += (L[i] / length);
	}
	return (cnt >= K);
}

int main(void) {
	int maxL=0;

	cin >> N;
	REP(i, N) {
		int a; cin >> a;
		L.push_back(a);
		if (a > maxL) maxL = a;
	}
	cin >> K;

	double left = 0;
	double right = maxL + 1;

	for (int i = 0; i < 2000;++i){
		double mid = (right + left) / 2.0;
		if (check(mid)) left = mid;
		else right = mid;
	}

	cout << std::fixed << setprecision(15);
	cout << left << endl;

	return 0;
}
0