結果
| 問題 |
No.67 よくある棒を切る問題 (1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-12 00:50:54 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 660 bytes |
| コンパイル時間 | 3,353 ms |
| コンパイル使用メモリ | 273,684 KB |
| 実行使用メモリ | 11,424 KB |
| 最終ジャッジ日時 | 2025-03-03 12:13:48 |
| 合計ジャッジ時間 | 16,108 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;
#define int long long
int n, k;
int a[200005];
bool check(double x) {
int ans = 0;
for (int i = 1; i <= n; i++) ans += (int)a[i] / x;
return ans >= k;
}
void solved() {
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
cin >> k;
double l = 0, r = 1e9;
for (int i = 1; i <= 1210200; i++) {
double mid = (l + r + 1) / 2;
if (check(mid))
l = mid;
else
r = mid - 1;
}
cout << l << endl;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
/*int t = 1;
cin >> t;
while (t--)*/
solved();
return 0;
}