結果
| 問題 | 
                            No.67 よくある棒を切る問題 (1)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kaito_tateyama
                         | 
                    
| 提出日時 | 2019-03-06 12:48:20 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,058 bytes | 
| コンパイル時間 | 818 ms | 
| コンパイル使用メモリ | 80,460 KB | 
| 実行使用メモリ | 22,820 KB | 
| 最終ジャッジ日時 | 2025-03-03 11:21:27 | 
| 合計ジャッジ時間 | 13,544 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | TLE * 1 -- * 29 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define P(x) cout << (x) << "\n"
#define D(x) cerr << (x) << "\n"
#define fcout cout << fixed << setprecision(18)
using i64 = long long int; // 10^18
static const double eps = (1e-10);
vector<double> l;
i64 k;
bool isOK(double s)
{
    double sum = 0;
    for (auto ll : l)
    {
        sum += (i64)floor(ll / s);
    }
    return sum >= k;
}
double binary_search()
{
    double ng = 0;
    double ok = 10000000000;
    while (abs(ok - ng) > eps)
    {
        double mid = ng + (double (ok - ng)) / 2;
        if (!isOK(mid))
        {
            ok = mid;
        }
        else
        {
            ng = mid;
        }
    }
    return ok;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    REP(i, n)
    {
        double ll;
        cin >> ll;
        l.push_back(ll);
    }
    cin >> k;
    fcout<< binary_search() <<endl;
    return 0;
}
            
            
            
        
            
kaito_tateyama