結果
| 問題 | No.67 よくある棒を切る問題 (1) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-10-12 00:56:23 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1,328 ms / 5,000 ms | 
| コード長 | 661 bytes | 
| コンパイル時間 | 3,624 ms | 
| コンパイル使用メモリ | 271,672 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2025-03-03 12:14:41 | 
| 合計ジャッジ時間 | 34,813 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 30 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;
#define int long long
int n, k;
int a[200005];
bool check(double x) {
  int ans = 0;
  for (int i = 1; i <= n; i++) ans += (int)a[i] / x;
  return ans >= k;
}
void solved() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  cin >> k;
  double l = 0, r = 1e9;
  for (int i = 1; i <= 1000; i++) {
    double mid = (l + r + 1) / 2;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  printf("%.15lf\n", l);
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  /*int t = 1;
  cin >> t;
  while (t--)*/
  solved();
  return 0;
}
            
            
            
        