QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#207084#5152. Circular Caramel CookieMinhhoWA 41ms3980kbC++201.1kb2023-10-08 08:17:482023-10-08 08:17:49

Judging History

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

  • [2023-10-08 08:17:49]
  • 评测
  • 测评结果:WA
  • 用时:41ms
  • 内存:3980kb
  • [2023-10-08 08:17:48]
  • 提交

answer

#define taskname "C"
#include <bits/stdc++.h>
#define ld long double
#define int long long

using namespace std;
const ld lim = sqrt(2.0L) - 1;

inline int cal(ld x)
{
    int le = (x - trunc(x) >= lim ? trunc(x) : trunc(x-1));
    int wi = sqrt(x*x-le*le);
    int la = le - wi;
    int cx = wi, cy = le, ans = 0, cur = 0;
    for (int i=0; i<la; i++)
    {
        while ((cx+cur)*(cx+cur) + cy*cy <= x * x) cur++;
        ans += cur - 1;
        cy--;
    }
    wi <<= 1;
    le <<= 1;
//    cerr<<le<<" "<<wi<<" "<<ans<<"\n";
    return 2 * le * wi - min(le, wi) * min(le, wi) + 4 * ans;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
//    cout<<cal(17841.8813190);
    for (int i=1; i<=1; i++)
    {
        int s; ld l = 0, r = 1e5;
        cin>>s;
//        s = i;
        for (int i=1; i<=1000; i++)
        {
            ld m = (l+r)/2;
    //        cerr<<m<<" "<<cal(m)<<"\n";
            if (cal(m) > s) r = m;
            else l = m;
        }
//        cout<<i<<" ";
        cout<<fixed<<setprecision(9)<<r<<"\n";
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3928kb

input:

11

output:

2.236067977

result:

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

Test #2:

score: 0
Accepted
time: 1ms
memory: 3928kb

input:

59

output:

5.000000000

result:

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

Test #3:

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

input:

1

output:

1.414213562

result:

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

Test #4:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

2

output:

1.414213562

result:

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

Test #5:

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

input:

3

output:

1.414213562

result:

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

Test #6:

score: 0
Accepted
time: 1ms
memory: 3980kb

input:

4

output:

2.236067977

result:

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

Test #7:

score: 0
Accepted
time: 41ms
memory: 3936kb

input:

1000000000

output:

17841.881318964

result:

ok found '17841.8813190', expected '17841.8813190', error '0.0000000'

Test #8:

score: -100
Wrong Answer
time: 1ms
memory: 3936kb

input:

16

output:

3.414213562

result:

wrong answer 1st numbers differ - expected: '3.1622777', found: '3.4142136', error = '0.0796691'