結果
| 問題 |
No.67 よくある棒を切る問題 (1)
|
| コンテスト | |
| ユーザー |
sio_puyo
|
| 提出日時 | 2014-11-16 23:35:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,200 bytes |
| コンパイル時間 | 1,431 ms |
| コンパイル使用メモリ | 159,284 KB |
| 実行使用メモリ | 13,604 KB |
| 最終ジャッジ日時 | 2025-03-03 10:02:56 |
| 合計ジャッジ時間 | 14,161 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 29 |
ソースコード
#include <bits/stdc++.h>
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define DECIM8 fixed<<setprecision(8)
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
using namespace std;
int main(void)
{
int n;
cin >> n;
vector<double> l;
l.resize(n);
double left=0,right=0;
REP(i,n) cin >> l[i];
LL k;
cin >> k;
REP(i,n) left=max(left,l[i]);
left/=k;
REP(i,n) right+=l[i];
right/=k;
while(right-left>EPS||right>left*(1+EPS)){
double tmp=(left+right)/2;
LL stick=0;
REP(i,l.size()) stick+=l[i]/tmp;
if(stick<k) right=tmp;
else left=tmp;
}
cout << fixed<<setprecision(10) << (left+right)/2 << endl;
return 0;
}
sio_puyo