mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
parent
957a1e8f42
commit
bbb3b3a0ce
60
S2OJ/225/225.cpp
Normal file
60
S2OJ/225/225.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 1e5 + 5;
|
||||
const double eps = 1e-7;
|
||||
|
||||
int n, k, a[N], b[N];
|
||||
double c[N];
|
||||
|
||||
inline bool check(double mid) {
|
||||
double sum = 0;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
c[i] = static_cast<double>(a[i]) - mid * b[i];
|
||||
}
|
||||
|
||||
std::sort(c + 1, c + 1 + n, std::greater<>());
|
||||
|
||||
for (int i = 1; i <= k; i++) {
|
||||
sum += c[i];
|
||||
}
|
||||
|
||||
return sum >= 0;
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n >> k;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> a[i];
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> b[i];
|
||||
}
|
||||
|
||||
double l = 0, r = 1e9;
|
||||
|
||||
while (r - l > eps) {
|
||||
double mid = (l + r) / 2;
|
||||
|
||||
if (check(mid)) {
|
||||
l = mid;
|
||||
} else {
|
||||
r = mid;
|
||||
}
|
||||
}
|
||||
|
||||
cout << std::fixed << std::setprecision(4) << l << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/225/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone11.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone12.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone13.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone14.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone15.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone16.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone17.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone18.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone19.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone20.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone21.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone21.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone22.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone22.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone23.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone23.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone24.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone24.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone25.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone25.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone26.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone26.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone26.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone27.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone27.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone27.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone28.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone28.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone28.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone29.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone29.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone29.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone30.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone30.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone30.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone31.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone31.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone31.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone32.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone32.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone32.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone33.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone33.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone33.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone33.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone34.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone34.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone34.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone34.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone35.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone35.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone35.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone35.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone36.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone36.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone36.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone36.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone37.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone37.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone37.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone37.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone38.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone38.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone38.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone38.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone39.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone39.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone39.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone39.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone40.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone40.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone40.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone40.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone41.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone41.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone41.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone41.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone42.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone42.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone42.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone42.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone43.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone43.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone43.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone43.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone44.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone44.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone44.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone44.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone45.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone45.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone45.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone45.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone46.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone46.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone46.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone46.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone47.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone47.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone47.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone47.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone48.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone48.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone48.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone48.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone49.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone49.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone49.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone49.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone50.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone50.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone50.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone50.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/225/data/zerone8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/225/data/zerone8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user