QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501221 | #5152. Circular Caramel Cookie | Abcl | WA | 0ms | 3952kb | C++14 | 736b | 2024-08-02 15:47:33 | 2024-08-02 15:47:34 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=200005;
const double hu=3.14159265358*10/4.0;
int n;
double ans;
void solve(){
cin>>n;
int k=0;
double a,b;
for(int i=sqrt(1e9) ;i>=0;i--){
if( pow(i,2) <=n ){
k=i;
break;
}
}
// cout<<k<<endl;
if(k*k==n){
a=k,b=k;
}
else if((k+1)*(k+1)-4>=n){
k++;a=k,b=k-2;
}
else {
a=k+1,b=k+1;
}
// cout<<a<<" "<<b<<endl;
ans=sqrt(a*a+b*b)/2.0;
printf("%.10lf",ans);
return;
}
signed main() {
// ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int T_case=1;
// cin>>T_case;
while(T_case--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3952kb
input:
11
output:
2.2360679775
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
59
output:
5.0000000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3752kb
input:
1
output:
0.7071067812
result:
wrong answer 1st numbers differ - expected: '1.4142136', found: '0.7071068', error = '0.5000000'