結果

問題 No.67 よくある棒を切る問題 (1)
コンテスト
ユーザー Unbakedbread
提出日時 2025-12-29 19:27:00
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 320 ms / 5,000 ms
コード長 490 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,216 ms
コンパイル使用メモリ 279,488 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-12-29 19:27:14
合計ジャッジ時間 12,580 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

using ld = long double;
using ll = long long;

int main(void) {
	cout << fixed << setprecision(30);
	
	int N;
	cin >> N;
	vector<ld> L(N);
	for(int i = 0; i < N; ++i) cin >> L[i];
	ll K;
	cin >> K;
	
	ld ok = 0, ng = 2e10;
	for(int _ = 0; _ < 100; ++_) {
		ld mid = (ng + ok) / 2;
		
		ll cnt = 0;
		for(int i = 0; i < N; ++i) cnt += static_cast<ll>(floor(L[i] / mid));
		
		(cnt >= K ? ok : ng) = mid;
	}
	
	cout << ok << "\n";
	
	return 0;
}
0