結果
| 問題 | No.67 よくある棒を切る問題 (1) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-02-20 12:27:59 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 253 ms / 5,000 ms | 
| コード長 | 710 bytes | 
| コンパイル時間 | 850 ms | 
| コンパイル使用メモリ | 100,296 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2025-03-03 12:07:19 | 
| 合計ジャッジ時間 | 7,111 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 30 | 
ソースコード
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <queue>
#include <cassert>
#include <cmath>
#include <bitset>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<double> l(n);
  for (int i = 0; i < n; i++) cin >> l[i];
  long long k;
  cin >> k;
  double ok = 0;
  double ng = 1e10;
  for (int j = 0; j < 100 && ok+1e-10 < ng; j++) {
    double x = (ok+ng)/2.0;
    long long cnt = 0;
    for (int i = 0; i < n; i++) cnt += floor(l[i]/x);
    //cout << "x = " << x << ", cnt = " << cnt << endl;
    if (cnt >= k) ok = x;
    else ng = x;
  }
  printf("%.15lf\n", ok);
}
            
            
            
        