QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501187 | #5152. Circular Caramel Cookie | ssmy | WA | 0ms | 3924kb | C++20 | 897b | 2024-08-02 15:29:40 | 2024-08-02 15:29:40 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
int n;
std:: cin >> n;
if(n <= 3)
{
std:: cout << setprecision(10) << sqrt(2) << endl;
return ;
}
int x = 4;
double ans;
for(int i = x; ;i ++ )
{
if(i * i > n)
{
if(i % 2 == 0)
{
ans = sqrt((i / 2) * (i / 2) + (i / 2 - 1) * (i / 2 - 1));
break;
}
else
{
ans = sqrt((i / 2 + 0.5) * (i / 2 + 0.5) + (i / 2 - 1 + 0.5) * (i / 2 - 1 + 0.5));
break;
}
}
}
std:: cout << setprecision(10) << ans << endl;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
// int T;
// std:: cin >> T;
// while(T -- )
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3812kb
input:
11
output:
2.236067977
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
59
output:
5
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
1
output:
1.414213562
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
2
output:
1.414213562
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
3
output:
1.414213562
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
4
output:
2.236067977
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3924kb
input:
1000000000
output:
22360.13065
result:
wrong answer 1st numbers differ - expected: '17841.8813190', found: '22360.1306500', error = '0.2532384'