結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー togatogatogatoga
提出日時 2015-08-20 23:53:28
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 936 bytes
コンパイル時間 1,256 ms
コンパイル使用メモリ 149,788 KB
実行使用メモリ 4,932 KB
最終ジャッジ日時 2023-09-25 14:02:11
合計ジャッジ時間 13,724 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 476 ms
4,700 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 457 ms
4,748 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 480 ms
4,588 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 394 ms
4,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 406 ms
4,376 KB
testcase_16 AC 456 ms
4,764 KB
testcase_17 AC 455 ms
4,752 KB
testcase_18 AC 456 ms
4,764 KB
testcase_19 AC 478 ms
4,568 KB
testcase_20 AC 478 ms
4,580 KB
testcase_21 AC 477 ms
4,580 KB
testcase_22 AC 409 ms
4,444 KB
testcase_23 AC 434 ms
4,584 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 4 ms
4,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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};
int 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 < 300; i++){
    double med = (right + left) / 2.0;
    if (check(med)){
      left = med;
    }else{
      right = med;
    }
  }
  printf("%.20lf\n", left);
}
0