Skip to content
Snippets Groups Projects
Commit 2f9b60fa authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Add LA3635

parent 9a9fa0e3
No related branches found
No related tags found
No related merge requests found
#include <bits/stdc++.h>
#define EPS 1e-6
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define llinf 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define sz size()
#define pb push_back
#define ende '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout << setprecision(9) << fixed;
int t; cin >> t;
while (t--) {
int n, f; cin >> n >> f;
vector<double> v(n);
for (auto &i : v)
cin >> i;
double l = 0.0, r = (double) llinf;
for (int i = 0; i < 300; ++i) {
double m = (l + r) / 2.0;
int p = 0;
for (int j = 0; j < n; ++j)
p += (int) floor((v[j] * v[j] * M_PI) / m);
if (p >= f + 1)
l = m;
else
r = m;
}
cout << l << ende;
}
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment