結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
![]() |
提出日時 | 2014-11-16 23:34:24 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1,402 ms / 5,000 ms |
コード長 | 1,403 bytes |
コンパイル時間 | 1,520 ms |
コンパイル使用メモリ | 157,312 KB |
実行使用メモリ | 8,608 KB |
最終ジャッジ日時 | 2025-03-03 10:02:50 |
合計ジャッジ時間 | 34,257 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#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=aconst 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);}