結果
| 問題 | No.67 よくある棒を切る問題 (1) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2015-02-15 00:32:19 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 558 bytes | 
| コンパイル時間 | 557 ms | 
| コンパイル使用メモリ | 64,700 KB | 
| 実行使用メモリ | 8,612 KB | 
| 最終ジャッジ日時 | 2025-03-03 10:14:55 | 
| 合計ジャッジ時間 | 6,535 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 14 WA * 16 | 
ソースコード
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
int main() {
	int n, k;
	cin >> n;
	vector<double> l(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}
	cin >> k;
	double upper = 1e9;
	double lower = 0;
	double mid;
	long long count;
	for (int i = 0; i < 100; i++) {
		mid = (upper + lower) / 2;
		count = 0;
		for (int i = 0; i < n; i++) {
			count += l[i] / mid;
		}
		if (count >= k) {
			lower = mid;
		} else {
			upper = mid;
		}
	}
	printf("%.10f\n", mid);
	return 0;
}
            
            
            
        