QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501167#5152. Circular Caramel CookieAu_GoldWA 0ms3864kbC++20660b2024-08-02 15:07:402024-08-02 15:07:41

Judging History

你现在查看的是最新测评结果

  • [2024-08-02 15:07:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3864kb
  • [2024-08-02 15:07:40]
  • 提交

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