QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501248 | #5152. Circular Caramel Cookie | Abcl | WA | 0ms | 3920kb | C++14 | 762b | 2024-08-02 16:02:55 | 2024-08-02 16:02:56 |
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;
if(n==1){
ans=1.4142135624;
printf("%.10lf",ans);
return;}
int f=0;
int minl=1e11;
for(int i=sqrt(1e9) ;i>=0;i--){
if(i*i-n>0&&(i*i-n)<minl){
minl=i*i-n;
k=i;
}
else break;
}
// cout<<k<<endl;
a=k-2,b=k;
// 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: 3920kb
input:
11
output:
2.2360679775
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
59
output:
5.0000000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
1
output:
1.4142135624
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3916kb
input:
2
output:
1.0000000000
result:
wrong answer 1st numbers differ - expected: '1.4142136', found: '1.0000000', error = '0.2928932'