QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#201247#5152. Circular Caramel CookieDelay_for_five_minutes#WA 1ms3852kbC++20503b2023-10-05 13:21:532023-10-05 13:21:55

Judging History

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

  • [2023-10-05 13:21:55]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3852kb
  • [2023-10-05 13:21:53]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const double eps = 5e-7;
long long get(double s)
{
    long long ans = 0;
    double p = s * s;
    for(int i = 1;i <= s;i++) {
        ans += 4*((int)(sqrt(p - i*i))) ;
    }
    return ans;
}
int main()
{
    int s;cin >> s;
    double l = 0 , r = sqrt(s) ;
    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: 1ms
memory: 3852kb

input:

11

output:

2.236068230594

result:

ok found '2.2360682', expected '2.2360680', error '0.0000001'

Test #2:

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

input:

59

output:

5.000000273944

result:

ok found '5.0000003', expected '5.0000000', error '0.0000001'

Test #3:

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

input:

1

output:

0.999999761581

result:

wrong answer 1st numbers differ - expected: '1.4142136', found: '0.9999998', error = '0.2928934'