QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501129 | #5152. Circular Caramel Cookie | zmrzmr | WA | 0ms | 3732kb | C++20 | 587b | 2024-08-02 14:38:30 | 2024-08-02 14:38:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n;
int main()
{
cin>>n;
double ans2;
int flag;
for(int i = 1 ; ; i++ )
{
if(4*(i-1)*(i-1)-4 >= n )
{
flag = i ;
break;
}
}
for(int i = 1 ; i < 1e3; i++ )
{
ll tt = i*i*4;
if(tt==n)
{
double t = i *1.0 * sqrt(2);
printf("%.10llf",t);
return 0;
}
if(tt>n)
{
ans2 = i *1.0 * sqrt(2);
break;
}
}
ll num = (flag-1)*(flag-1) + (flag-2)*(flag-2) ;
double ans1 = sqrt(num);
double ans = min(ans1,ans2);
printf("%.10llf",ans);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3732kb
input:
11
output:
nan
result:
wrong output format Expected double, but "nan" found