結果
問題 | No.67 よくある棒を切る問題 (1) |
ユーザー |
|
提出日時 | 2024-10-12 00:54:14 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 657 bytes |
コンパイル時間 | 3,353 ms |
コンパイル使用メモリ | 273,860 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-03-03 12:14:10 |
合計ジャッジ時間 | 34,810 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 29 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define endl "\n"typedef long long ll;#define int long longint 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 <= 1000; i++) {double mid = (l + r + 1) / 2;if (check(mid))l = mid;elser = 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;}