結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
|
提出日時 | 2019-07-09 00:48:26 |
言語 | C++11 (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,252 bytes |
コンパイル時間 | 916 ms |
コンパイル使用メモリ | 83,144 KB |
実行使用メモリ | 11,556 KB |
最終ジャッジ日時 | 2024-10-10 02:27:59 |
合計ジャッジ時間 | 14,553 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 30 |
ソースコード
#include <iostream> #include <string> #include <utility> #include <algorithm> #include <map> #include <set> #include <vector> #include <cmath> #include <cstdlib> #include <queue> #include <stack> #include <iomanip> using namespace std; #define REP(i, n) for(ll i = 0;i < n;i++) #define REPR(i, n) for(ll i = n;i >= 0;i--) #define FOR(i, m, n) for(ll i = m;i < n;i++) #define FORR(i, m, n) for(ll i = m;i >= n;i--) #define REPO(i, n) for(ll i = 1;i <= n;i++) #define ll long long #define INF (ll)1 << 60 #define MINF (-1 * INF) #define ALL(n) n.begin(),n.end() #define MOD (ll)1000000007 #define P pair<ll, ll> double eps = 1e-10, s[210000]; ll n, k; bool solve(double index) { //条件判定 ll now = 0; REP(i, n) { double nn = (double)s[i] / index; now += (ll)nn; } if (now >= k) return true; //ここに条件を入れる else return false; } double nibutan() { //めぐる式 double ng = 1e9+10; //最大値ならs.size() double ok = 0; // 最大値なら0 while (abs(ok - ng) > eps) { double mid = (ok + ng) / 2; if (solve(mid)) ok = mid; else ng = mid; } return ok; //満たさない最大ならng } int main() { cin >> n; REP(i, n)cin >> s[i]; cin >> k; cout << setprecision(10) << fixed << nibutan() << endl; }