結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー yukke428yukke428
提出日時 2020-05-03 00:28:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 959 bytes
コンパイル時間 983 ms
コンパイル使用メモリ 84,128 KB
実行使用メモリ 4,576 KB
最終ジャッジ日時 2023-08-30 15:09:21
合計ジャッジ時間 35,177 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,361 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1,333 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1,357 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1,154 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1,152 ms
4,380 KB
testcase_16 AC 1,333 ms
4,376 KB
testcase_17 AC 1,331 ms
4,380 KB
testcase_18 AC 1,333 ms
4,380 KB
testcase_19 AC 1,350 ms
4,376 KB
testcase_20 AC 1,343 ms
4,380 KB
testcase_21 AC 1,350 ms
4,380 KB
testcase_22 AC 1,199 ms
4,384 KB
testcase_23 AC 1,263 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 9 ms
4,508 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<29;
//const ll INF = (ll)1e18 + 1;

int N, K;
vector<int> L;
bool c(double x){
  int sum = 0;
  rep(i, N){
    sum += L[i] / x;
  }
  return sum >= K;
}

int main(){
  cin >> N;
  L = vector<int>(N);
  rep(i, N) cin >> L[i];
  cin >> K;

  double left = 0, right = 1e10+1;
  rep(i, 1000){
    double mid = (right + left) / 2;
    if (c(mid)) left = mid;
    else right = mid;
  }
  printf("%.9f\n", left);
}
0