QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501169#5152. Circular Caramel CookieAu_GoldWA 0ms3788kbC++20660b2024-08-02 15:09:162024-08-02 15:09:17

Judging History

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

  • [2024-08-02 15:09:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3788kb
  • [2024-08-02 15:09:16]
  • 提交

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