結果
| 問題 |
No.67 よくある棒を切る問題 (1)
|
| コンテスト | |
| ユーザー |
otsnsk
|
| 提出日時 | 2014-12-27 20:03:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 5,000 ms |
| コード長 | 872 bytes |
| コンパイル時間 | 512 ms |
| コンパイル使用メモリ | 63,864 KB |
| 実行使用メモリ | 8,608 KB |
| 最終ジャッジ日時 | 2025-03-03 10:14:09 |
| 合計ジャッジ時間 | 2,441 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#include <iostream>
#include <iomanip>
#define FORR(i,b,e) for(int i=(b);i<(int)(e);++i)
#define FOR(i,e) FORR(i,0,e)
#define dump(var) cerr << #var ": " << var << "\n"
#define dumpc(con) for(auto& e: con) cerr << e << " "; cerr<<"\n"
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int L[200010];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
ll K;
double lmax = 0;
cin >> N;
FOR(i, N) {
cin >> L[i];
lmax += L[i];
}
cin >> K;
lmax /= K;
double l = 0.0, u = lmax, m;
FOR(i, 50) {
m = (l+u)/2;
ll cnt = 0;
FOR(j, N) {
cnt += (ll)(L[j]/m);
}
if (cnt < K) {
u = m;
}
else {
l = m;
}
}
cout << fixed << setprecision(10) << m << endl;
return 0;
}
otsnsk