結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
![]() |
提出日時 | 2019-04-09 16:48:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 189 ms / 5,000 ms |
コード長 | 655 bytes |
コンパイル時間 | 1,523 ms |
コンパイル使用メモリ | 162,428 KB |
実行使用メモリ | 8,604 KB |
最終ジャッジ日時 | 2025-03-03 11:24:37 |
合計ジャッジ時間 | 6,681 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0; i<n; i++) #define all(x) (x).begin(),(x).end() #define INF (1000000000) #define MOD (1000000007) ll N,K; double L[200010]; bool C(double x){//長さxの紐をK本作れるか ll ret = 0; rep(i,N){ ret += floor(L[i]/x); } return ret >= K; } int main(){ cin >> N; rep(i,N){ cin >> L[i]; } cin >> K; double ok = 0, ng = 1000000000; while(!(ng-ok <= 1e-12 || ng-ok <= ok*1e-12)){ double mid = (ok+ng)/2; if(C(mid)){ ok = mid; }else{ ng = mid; } } cout << fixed << setprecision(12) << ok << endl; }