QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#359976 | #5152. Circular Caramel Cookie | kevinyang# | WA | 1ms | 3980kb | C++17 | 543b | 2024-03-21 07:55:43 | 2024-03-21 07:55:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
int s;
cin >> s;
double low = 0; double high = 1e5;
for(int iters = 0; iters < 70; iters++){
double r = (low+high)/2;
int ans = 0;
for(int i = 1; i<=r; i++){
//x^2 + y^2 = r^2
// x = sqrt(r^2 - y^2);
int v = sqrt(r*r - i*i);
ans+=v*4;
}
if(ans>=s){
high = r;
}
else{
low = r;
}
}
cout << fixed << setprecision(12);
cout << high << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3940kb
input:
11
output:
2.236067977500
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
59
output:
5.000000000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3924kb
input:
1
output:
1.414213562373
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3736kb
input:
2
output:
1.414213562373
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3980kb
input:
3
output:
1.414213562373
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 3856kb
input:
4
output:
1.414213562373
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'