結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー nmnmnmnmnmnmnmnmnmnmnmnmnmnm
提出日時 2014-11-16 23:30:07
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,179 bytes
コンパイル時間 683 ms
コンパイル使用メモリ 87,404 KB
実行使用メモリ 8,588 KB
最終ジャッジ日時 2023-08-30 07:31:48
合計ジャッジ時間 13,596 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
 
#define MOD 1000000009

long long n;
vector<int> v;
long long k;

int check(double d){
  long long a = 0;
  rep(i,0,n){
    a += 1.*v[i]/d;
  }
  if(k <= a)return 1;
  return 0;
}

int main(){
  cin >> n;
  rep(i,0,n){
    long long a;
    cin >> a;
    v.pb(a);
  }
  cin >> k;
  double low = 0.0;
  double high = 10000000005.0;

  while(high - low > 1e-12){
    double mid = (low + high) / 2;
    if(check(mid)){
  	  low = mid;
    }
    else{
      high = mid;
    }
  }
  cout << low << endl;
  return 0;
}
0