QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501182#5152. Circular Caramel CookieFoedere0WA 0ms3908kbC++23913b2024-08-02 15:26:312024-08-02 15:26:32

Judging History

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

  • [2024-08-02 15:26:32]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3908kb
  • [2024-08-02 15:26:31]
  • 提交

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;
        }
        if(n==4){
        	n=11;
		}


        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: 3780kb

input:

11

output:

2.23606798

result:

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

Test #2:

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

input:

59

output:

5.00000000

result:

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

Test #3:

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

input:

1

output:

1.41421360

result:

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

Test #4:

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

input:

2

output:

1.41421360

result:

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

Test #5:

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

input:

3

output:

1.41421360

result:

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

Test #6:

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

input:

4

output:

2.23606798

result:

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

Test #7:

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

input:

1000000000

output:

16962.28003542

result:

wrong answer 1st numbers differ - expected: '17841.8813190', found: '16962.2800354', error = '0.0492998'