QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#201299#5152. Circular Caramel CookieDelay_for_five_minutes#WA 0ms3944kbC++20633b2023-10-05 13:35:582023-10-05 13:35:58

Judging History

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

  • [2023-10-05 13:35:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3944kb
  • [2023-10-05 13:35:58]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
long long get(double s)
{
    long long ans = 0;
    double p = s * s;
    for(int i = 1;i <= s;i++) {
        int d = ((int)(sqrt(p - i*i) + eps)) ;
        while(1LL*(d+1)*(d+1) + 1LL*i*i <= p) d++ ;
        while(1LL*d*d + 1LL*i*i > p) d--;
        ans += 4LL * d;
    }
    return ans;
}
int main()
{
    int s;cin >> s;
    double l = 1 , r = sqrt(s) + 20;
    while((r - l) / l > eps) {
        double md = (l + r) / 2;
        if(get(md) >= s) r = md;
        else l = md;
    }
    printf("%.12lf\n",(l + r) / 2);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

11

output:

2.236067977803

result:

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

Test #2:

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

input:

59

output:

4.999999999447

result:

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

Test #3:

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

input:

1

output:

1.414213562035

result:

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

Test #4:

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

input:

2

output:

1.414213562722

result:

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

Test #5:

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

input:

3

output:

1.414213561959

result:

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

Test #6:

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

input:

4

output:

1.414213562181

result:

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