QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501227 | #5152. Circular Caramel Cookie | Railgun2334 | WA | 1ms | 3964kb | C++20 | 1.0kb | 2024-08-02 15:48:28 | 2024-08-02 15:48:28 |
Judging History
answer
/*
/\_/\
(= ._.)
/ > \>
*/
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cstdio>
#include <cmath>
#include <cassert>
#define int long long
#define double long double
using namespace std;
const int N = 4e5 + 10, M = 1e6 + 10, MOD = 1e9 + 7;
int a[N];
pair<int, int> b[N];
int check(double r) {
int ans = 0;
for (int i = 1; i <= r; i++) {
int x = i, y = sqrt(r * r - x * x);
ans += y;
}
return ans * 4;
}
void solve() {
int n;
cin >> n;
double l = 0, r = 1e5;
while (r - l > 1e-10) {
double mid = (r + l) / 2;
if (check(mid) >= n) {
r = mid;
} else {
l = mid;
}
}
printf("%.10Lf", l);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int TT = 1;
//cin >> TT;
while (TT--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3964kb
input:
11
output:
2.2360679774
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3944kb
input:
59
output:
5.0000000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3896kb
input:
1
output:
1.4142135623
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
2
output:
1.4142135623
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
3
output:
1.4142135623
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 3820kb
input:
4
output:
1.4142135623
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'