結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー glretoglreto
提出日時 2021-01-23 09:32:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 221 ms / 5,000 ms
コード長 1,068 bytes
コンパイル時間 1,033 ms
コンパイル使用メモリ 86,220 KB
実行使用メモリ 9,864 KB
最終ジャッジ日時 2024-04-26 01:14:37
合計ジャッジ時間 7,156 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 221 ms
9,712 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 84 ms
6,940 KB
testcase_03 AC 159 ms
7,960 KB
testcase_04 AC 199 ms
9,736 KB
testcase_05 AC 198 ms
9,864 KB
testcase_06 AC 200 ms
9,628 KB
testcase_07 AC 216 ms
9,716 KB
testcase_08 AC 216 ms
9,808 KB
testcase_09 AC 212 ms
9,740 KB
testcase_10 AC 172 ms
9,044 KB
testcase_11 AC 183 ms
9,516 KB
testcase_12 AC 169 ms
8,928 KB
testcase_13 AC 198 ms
9,124 KB
testcase_14 AC 204 ms
9,352 KB
testcase_15 AC 187 ms
8,832 KB
testcase_16 AC 198 ms
9,736 KB
testcase_17 AC 193 ms
9,760 KB
testcase_18 AC 198 ms
9,820 KB
testcase_19 AC 217 ms
9,740 KB
testcase_20 AC 214 ms
9,864 KB
testcase_21 AC 215 ms
9,708 KB
testcase_22 AC 174 ms
9,128 KB
testcase_23 AC 187 ms
9,580 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 5 ms
6,944 KB
testcase_26 AC 4 ms
6,940 KB
testcase_27 AC 3 ms
6,940 KB
testcase_28 AC 33 ms
6,940 KB
testcase_29 AC 18 ms
6,944 KB
testcase_30 AC 5 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
#include<map>
#include<queue>
#include<set>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(ll i = n-1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;
ll mod = 1e9 + 7;
int n;ll k;
bool ch(ld L, vector<ld> a) {
    ll cnt = 0;
    rep(i, n) {
        cnt += (ll)(a[i] / L);
    }if (cnt >= k)return 1;
    else return 0;
}
int main() {
    cin >> n; vector<ld> l(n);
    rep(i, n) cin >> l[i];
    cin >> k;
    ld ok = 0, ng = 1e9;
    rep(i,100) {
        ld mid = (ng + ok) / 2;
        if (ch(mid, l)) ok = mid;
        else ng = mid;
    }cout << fixed << setprecision(10) << ok << endl;
}
0