QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501169 | #5152. Circular Caramel Cookie | Au_Gold | WA | 0ms | 3788kb | C++20 | 660b | 2024-08-02 15:09:16 | 2024-08-02 15:09:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const int N = 1e5 + 5, M = 1e4 + 5, mod = 7;
const double gen2 = sqrt(2);
// fabs(b-(int)b)<1e-8
int main()
{
ll s;
cin >> s;
s++; // 需要的格子数
ll a = ceil(1.0 * s / 4);
double n = sqrt(a);
ll m = (ll)n;
if (fabs(n - (ll)n) < 1e-7)
{ // 整数时
//cout << m * gen2 << endl;
printf("%llf\n", m * gen2);
}
else
{ // 小数
//cout << sqrt((m * m + (m + 1) * (m + 1))*1.0) << endl;
printf("%llf\n", sqrt(m * m + (m + 1) * (m + 1)));
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3788kb
input:
11
output:
nan
result:
wrong output format Expected double, but "nan" found