結果
| 問題 |
No.67 よくある棒を切る問題 (1)
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-11-07 18:36:25 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 839 bytes |
| コンパイル時間 | 2,230 ms |
| コンパイル使用メモリ | 170,848 KB |
| 実行使用メモリ | 10,660 KB |
| 最終ジャッジ日時 | 2025-03-03 12:17:56 |
| 合計ジャッジ時間 | 9,954 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 TLE * 1 -- * 13 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
#define ios ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define f first
#define s second
#define endl "\n"
const int N=2e5+10;
LL n,k;
int a[N];
bool check(double x)
{
LL res=0;
if(x<1e-9)return true;
for(int i=1;i<=n;i++)
{
res+=LL(1.0*a[i]/x);
if(res>=k)return true;
}
return res>=k;
}
int main()
{
ios;
cin>>n;
int mx=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];mx=max(a[i],mx);
}
cin>>k;
double l=1e-9,r=1e9;
while(r-l>1e-9)
{
double mid=(l+r)/2;
if(check(mid))l=mid;
else r=mid;
}
cout<<fixed<<setprecision(15)<<l<<endl;
return 0;
}
//rrrbb
//6.666666666666667
//6.6666666666662877
vjudge1