結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー togatogatogatoga
提出日時 2015-08-20 23:55:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 226 ms / 5,000 ms
コード長 935 bytes
コンパイル時間 1,617 ms
コンパイル使用メモリ 163,476 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 23:28:47
合計ジャッジ時間 7,691 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 217 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 84 ms
6,940 KB
testcase_03 AC 160 ms
6,940 KB
testcase_04 AC 204 ms
6,940 KB
testcase_05 AC 201 ms
6,944 KB
testcase_06 AC 200 ms
6,940 KB
testcase_07 AC 223 ms
6,944 KB
testcase_08 AC 226 ms
6,940 KB
testcase_09 AC 223 ms
6,944 KB
testcase_10 AC 179 ms
6,940 KB
testcase_11 AC 191 ms
6,944 KB
testcase_12 AC 173 ms
6,940 KB
testcase_13 AC 206 ms
6,944 KB
testcase_14 AC 215 ms
6,944 KB
testcase_15 AC 193 ms
6,944 KB
testcase_16 AC 203 ms
6,940 KB
testcase_17 AC 203 ms
6,944 KB
testcase_18 AC 204 ms
6,940 KB
testcase_19 AC 226 ms
6,940 KB
testcase_20 AC 226 ms
6,940 KB
testcase_21 AC 226 ms
6,944 KB
testcase_22 AC 182 ms
6,940 KB
testcase_23 AC 193 ms
6,944 KB
testcase_24 AC 1 ms
6,944 KB
testcase_25 AC 6 ms
6,944 KB
testcase_26 AC 3 ms
6,940 KB
testcase_27 AC 3 ms
6,944 KB
testcase_28 AC 37 ms
6,940 KB
testcase_29 AC 20 ms
6,944 KB
testcase_30 AC 7 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define mp       make_pair
#define mt	 make_tuple
#define pb       push_back
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    pair<int,int>      pii;
typedef    pair<long,long>    pll;

const int INF=1<<29;
const double EPS=1e-9;
const int MOD = 100000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
ll N,K;
vector<ll> L;
bool check(double med){
  ll res = 0;
  for (int i = 0; i < N; i++){
    res += L[i] / med;
  }
  return res >= K ? true : false;
}
int main(){
  cin >> N;
  L.resize(N);
  for (int i = 0; i < N; i++){
    cin >> L[i];
  }
  sort(L.begin(),L.end());
  cin >> K;
  double left,right;
  left = 0;
  right = 1e10;
  for (int i = 0; i < 100; i++){
    double med = (right + left) / 2.0;
    if (check(med)){
      left = med;
    }else{
      right = med;
    }
  }
  printf("%.20lf\n", left);
}
0