結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー atetubouatetubou
提出日時 2014-11-16 23:34:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,365 ms / 5,000 ms
コード長 1,403 bytes
コンパイル時間 1,303 ms
コンパイル使用メモリ 145,028 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-08 05:32:07
合計ジャッジ時間 33,380 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,365 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 511 ms
4,380 KB
testcase_03 AC 980 ms
4,376 KB
testcase_04 AC 1,340 ms
4,376 KB
testcase_05 AC 1,337 ms
4,376 KB
testcase_06 AC 1,336 ms
4,376 KB
testcase_07 AC 1,361 ms
4,376 KB
testcase_08 AC 1,355 ms
4,380 KB
testcase_09 AC 1,355 ms
4,376 KB
testcase_10 AC 1,204 ms
4,380 KB
testcase_11 AC 1,271 ms
4,380 KB
testcase_12 AC 1,161 ms
4,380 KB
testcase_13 AC 1,240 ms
4,380 KB
testcase_14 AC 1,289 ms
4,376 KB
testcase_15 AC 1,154 ms
4,376 KB
testcase_16 AC 1,338 ms
4,376 KB
testcase_17 AC 1,338 ms
4,380 KB
testcase_18 AC 1,336 ms
4,380 KB
testcase_19 AC 1,358 ms
4,380 KB
testcase_20 AC 1,364 ms
4,376 KB
testcase_21 AC 1,359 ms
4,380 KB
testcase_22 AC 1,204 ms
4,376 KB
testcase_23 AC 1,273 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 28 ms
4,380 KB
testcase_26 AC 11 ms
4,376 KB
testcase_27 AC 9 ms
4,380 KB
testcase_28 AC 219 ms
4,376 KB
testcase_29 AC 110 ms
4,380 KB
testcase_30 AC 29 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef ll li;
typedef pair<ll,ll> PI;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define REP(i, n) rep (i, n)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) (a).begin(),(a).end()
#define FLL(a,b) memset((a),b,sizeof(a))
#define CLR(a) memset((a),0,sizeof(a))
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
#define FORR(it,a) for(__typeof(a.rbegin())it=a.rbegin();it!=a.rend();++it)
template<typename T,typename U> ostream& operator<< (ostream& out, const pair<T,U>& val){return out << "(" << val.F << ", " << val.S << ")";}
template<class T> ostream& operator<< (ostream& out, const vector<T>& val){out << "{";rep(i,SZ(val)) out << (i?", ":"") << val[i];return out << "}";}
#define declare(a,it) __typeof(a) it=a
const double EPS = 1e-8;

const int dx[]={1,0,-1,0,1,1,-1,-1,0};
const int dy[]={0,1,0,-1,-1,1,-1,1,0};

int main(int argc, char *argv[])
{
  int n;
  cin >> n;
  double low = 0;
  double up = 1e20;
  vector<int> l(n);
  rep(i,n) cin >> l[i];
  ll k;
  cin >> k;
  rep(i,1000){
    double mid = (low+up)/2;
    ll nu = 0;
    rep(j,n) nu += l[j]/mid;
    if(nu>=k) low = mid;
    else up = mid;
  }
  printf("%.18f\n",low);
}
0