QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#196885 | #5152. Circular Caramel Cookie | RobeZH# | WA | 1ms | 3924kb | C++14 | 946b | 2023-10-02 02:41:17 | 2023-10-02 02:41:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define subnb true
#define Lnb true
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
const ld EPS = 1e-10;
int s;
bool check(ld r) {
// int fr = r;
ll res = 0;
for (int i = 1; i <= r; i++) {
ld cur = r * r - (ld)i * i;
if(cur > EPS) {
ll h = ll(sqrt(cur));
res += h * 4;
}
}
return res >= s;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> s;
ld l = 0, r = 1e5, mid;
rep(it, 0, 60) {
mid = (l + r) / 2;
if(check(mid)) r = mid;
else l = mid;
}
cout << fixed << setprecision(15) << r << '\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3924kb
input:
11
output:
2.236067977499836
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
59
output:
5.000000000000056
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
1
output:
1.414213562373097
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
2
output:
1.414213562373097
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
3
output:
1.414213562373097
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 3832kb
input:
4
output:
1.414213562373097
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'