QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501180#5152. Circular Caramel CookieFoedere0WA 0ms3904kbC++23874b2024-08-02 15:23:062024-08-02 15:23:07

Judging History

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

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

answer

#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main(void)
{
        unsigned long long n;
        cin >> n;

        if (n <= 4)
        {
                double annn = 1.41421360;
                cout << fixed << setprecision(8) << annn << endl;
                return 0;
        }


        unsigned long long k = 0;
        unsigned long long sum = 0;

        int num = 1;
        while(sum + k * 4 <= n)
        {
                sum += k * 4;
                sum += 4;
                num++;
                k = k + 2;
        }

        unsigned long long ksum = n - sum;
        ksum = ceil(ksum / 8.0);

        //cout << sum << endl;
        double r = sqrt(ksum * ksum + num * num);

//      cout << r << endl;

        cout << fixed << setprecision(8) << r << endl;
        return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3728kb

input:

11

output:

2.23606798

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

59

output:

5.00000000

result:

ok found '5.0000000', expected '5.0000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

1

output:

1.41421360

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3780kb

input:

2

output:

1.41421360

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

3

output:

1.41421360

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 3712kb

input:

4

output:

1.41421360

result:

wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'