結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー mamekin
提出日時 2015-01-17 08:03:22
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 116 ms / 5,000 ms
コード長 859 bytes
コンパイル時間 654 ms
コンパイル使用メモリ 94,268 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2025-03-03 10:14:08
合計ジャッジ時間 4,170 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> len(n);
    for(int i=0; i<n; ++i)
        cin >> len[i];

    long long k;
    cin >> k;

    double a = 0;
    double b = 1000000000;
    for(int i=0; i<100; ++i){
        double x = (a + b) / 2;
        long long cnt = 0;
        for(int j=0; j<n; ++j)
            cnt += (long long)(len[j] / x);

        if(cnt < k)
            b = x;
        else
            a = x;
    }
    printf("%.10f\n", a);

    return 0;
}
0