結果

問題 No.67 よくある棒を切る問題 (1)
コンテスト
ユーザー zimpha
提出日時 2017-12-05 11:13:53
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 122 ms / 5,000 ms
コード長 520 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 457 ms
コンパイル使用メモリ 78,232 KB
実行使用メモリ 9,204 KB
最終ジャッジ日時 2026-07-06 16:57:42
合計ジャッジ時間 4,882 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <cmath>
#include <cstdio>
#include <vector>

using int64 = long long;

int main() {
  int n;
  scanf("%d", &n);
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  int64 k;
  scanf("%lld", &k);
  double left = 0, right = 1e9;
  for (int it = 0; it < 100; ++it) {
    double mid = (left + right) * 0.5;
    int64 cnt = 0;
    for (auto &&e: a) {
      cnt += floor(e / mid);
    }
    if (cnt >= k) left = mid;
    else right = mid;
  }
  printf("%.20f\n", left);
  return 0;
}
0