QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#501167 | #5152. Circular Caramel Cookie | Au_Gold | WA | 0ms | 3864kb | C++20 | 660b | 2024-08-02 15:07:40 | 2024-08-02 15:07:41 |
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-8)
{ // 整数时
//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;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3864kb
input:
11
output:
nan
result:
wrong output format Expected double, but "nan" found