QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#133045#5152. Circular Caramel CookieRabeya#WA 1ms3732kbC++201.0kb2023-08-01 13:50:282023-08-01 13:50:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-01 13:50:35]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3732kb
  • [2023-08-01 13:50:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define ld long double

const int N = 2e5 + 5;
const ld eps = 0.000000001;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    ll n;
    cin>> n;
    ld l = 0, r = 20000;
    while(l <= r-eps) {
        ld mid = (l+r)/2;

        ld height = 1;
        ll cnt = 0;
        while(height <= mid) {
            ld val = mid*mid - height*height;
            ld base = sqrtl(mid*mid - height*height);
            ll baseint = base;
            baseint += 5;
            while(baseint * baseint > val) baseint--;
            baseint *= 2;
            cnt += baseint;
            height++;
            if(cnt * 2 >= n) break;
            //cout<< mid << " " << cnt*2 << endl;
        }
        //cout<< cnt*2<< endl;
        cnt *= 2;
        if(cnt >= n) {
            r = mid;
            //cout<< mid << " yes" << endl;
        }
        else l = mid;
    }
    cout<< setprecision(12) << fixed << r << endl;
}


詳細信息

Test #1:

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

input:

11

output:

2.236067977606

result:

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

Test #2:

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

input:

59

output:

5.000000000450

result:

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

Test #3:

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

input:

1

output:

1.414213562612

result:

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

Test #4:

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

input:

2

output:

1.414213562612

result:

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

Test #5:

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

input:

3

output:

1.414213562612

result:

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

Test #6:

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

input:

4

output:

1.414213562612

result:

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