結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
![]() |
提出日時 | 2016-02-25 13:44:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 150 ms / 5,000 ms |
コード長 | 1,095 bytes |
コンパイル時間 | 804 ms |
コンパイル使用メモリ | 81,420 KB |
実行使用メモリ | 8,604 KB |
最終ジャッジ日時 | 2025-03-03 10:29:05 |
合計ジャッジ時間 | 5,113 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <cstdio> #include <iostream> #include <algorithm> #include <complex> #include <queue> #include <map> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define FORR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define pb push_back #define ALL(a) (a).begin(),(a).end() #define EPS (1e-10) #define EQ(a,b) (abs((a)-(b)) < EPS) #define PI 3.1415926535 typedef long long ll; //typedef pair<int, int> P; //typedef complex<double> C; const int MAX_N = 200000; int N; double L[MAX_N]; ll K; void input() { cin >> N; REP(i, N) cin >> L[i]; cin >> K; } ll count(double length) { ll cnt = 0; REP(i, N) { cnt += (ll) (L[i] / length); } return cnt; } void solve() { double ok = 1e-10; double ng = 1e9 + 1; REP(i, 100) { double mid = (ok + ng) / 2; if (count(mid) >= K) { ok = mid; } else { ng = mid; } } printf("%.14f\n", ok); } int main() { input(); solve(); return 0; }