結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー ttkkggww
提出日時 2022-05-03 10:38:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,354 ms / 5,000 ms
コード長 506 bytes
コンパイル時間 4,473 ms
コンパイル使用メモリ 250,912 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-03-03 11:57:56
合計ジャッジ時間 36,328 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
int n;
vector<ll> L;
ll k = 0;

void solve(){
	double l = 0,r = 1e18;
	for(int i = 0;i<1000;i++){
		double m = (l + r ) /2;
		ll cnt = 0;
		for(int j = 0 ;j<n;j++){
			cnt += L[j]/m;
		}
		if(cnt<k)r = m;
		else l = m;
	}
	printf("%.10lf\n",l);
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> n ;
	L = vector<ll>(n);
	for(auto &i:L)cin >> i;
	cin >> k;
	solve();
}
0