結果
| 問題 | 
                            No.67 よくある棒を切る問題 (1)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-02-20 12:23:48 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 693 bytes | 
| コンパイル時間 | 725 ms | 
| コンパイル使用メモリ | 87,448 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2025-03-03 12:07:16 | 
| 合計ジャッジ時間 | 7,454 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 30 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:34:17: warning: use of ‘ll’ length modifier with ‘f’ type character has either no effect or undefined behavior [-Wformat=]
   34 |   printf("%.15llf\n", ok);
      |                 ^
            
            ソースコード
#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; 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("%.15llf\n", ok);
}