QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501143 | #5152. Circular Caramel Cookie | mmzskm | WA | 0ms | 3920kb | C++14 | 971b | 2024-08-02 14:47:26 | 2024-08-02 14:47:26 |
Judging History
answer
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<stack>
#include<iomanip>
#include<cmath>
using namespace std;
using ll = long long;
#define int ll
void solve()
{
int n;
cin >> n;
if (n >= 1 && n <= 3)
{
cout << fixed << setprecision(12) << sqrt(2);
return;
}
if (n == 4)
{
cout << fixed << setprecision(12) << sqrt(5);
return;
}
int k = 4;
while (true)
{
if (n <= k * k - 4 && n > (k - 2) * (k - 2) - 4)
{
break;
}
k += 2;
}
k /= 2;
cout << fixed << setprecision(12) << sqrt(k * k + (k - 1) * (k - 1));
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
//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: 3744kb
input:
11
output:
2.236067977500
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
59
output:
5.000000000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
1
output:
1.414213562373
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
2
output:
1.414213562373
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
3
output:
1.414213562373
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
4
output:
2.236067977500
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3800kb
input:
1000000000
output:
22360.837752642452
result:
wrong answer 1st numbers differ - expected: '17841.8813190', found: '22360.8377526', error = '0.2532780'