結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー vjudge1
提出日時 2024-11-06 21:05:48
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 1,165 bytes
コンパイル時間 3,518 ms
コンパイル使用メモリ 274,816 KB
実行使用メモリ 13,528 KB
最終ジャッジ日時 2025-03-03 12:14:59
合計ジャッジ時間 16,295 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// #include<bits/extc++.h>
#define endl '\n'
#define eps 1e-16
#define pb push_back
#define eb emplace_back
#define debug(x) cerr<<#x<<": "<<x<<'\n';
// using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair <ll,ll>;
using pii = pair <int,int>;
using ull = unsigned long long;
const int N = 1e6 + 5, MOD = 1e9 + 7;
mt19937_64 rnd (chrono::steady_clock::now().time_since_epoch().count());
int n;
ll k, a[N];
bool ck(ld x)
{
    ll have = 0;
    for(int i=1;i<=n;i++) have += (ll)floor(a[i]*1.0/x);
    return have >= k;
}
void isac()
{
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    cin>>k;
    ld l = 1e-11, r = 1e10;
    int cnt = 0;
    while(r-l>eps && cnt<=(int)1e4)
    {
        ld mid = (l + r)/2;
        if(ck(mid)) l = mid;
        else r = mid; 
        cnt ++;
    }
    cout<<fixed<<setprecision(15)<<l;
}
int main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int T = 1;
    // cin >> T;
    while (T--) isac();
    return 0;
}
/*
    Zena youth together.
    Such a pretty name.
    There will be a long story.
    Time will tell all.
*/
0