QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501227#5152. Circular Caramel CookieRailgun2334WA 1ms3964kbC++201.0kb2024-08-02 15:48:282024-08-02 15:48:28

Judging History

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

  • [2024-08-02 15:48:28]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3964kb
  • [2024-08-02 15:48:28]
  • 提交

answer

/*
    /\_/\
   (= ._.)
   / >  \>
*/
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cstdio>
#include <cmath>
#include <cassert>
#define int long long
#define double long double
using namespace std;
const int N = 4e5 + 10, M = 1e6 + 10, MOD = 1e9 + 7;
int a[N];
pair<int, int> b[N];
int check(double r) {
    int ans = 0;
    for (int i = 1; i <= r; i++) {
        int x = i, y = sqrt(r * r - x * x);
        ans += y;
    }
    return ans * 4;
}
void solve() {
    int n;
    cin >> n;
    double l = 0, r = 1e5;
    while (r - l > 1e-10) {
        double mid = (r + l) / 2;
        if (check(mid) >= n) {
            r = mid;
        } else {
            l = mid;
        }
    }
    printf("%.10Lf", l);
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TT = 1;
    //cin >> TT;
    while (TT--) {
        solve();
    }
    return 0;
}

详细

Test #1:

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

input:

11

output:

2.2360679774

result:

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

Test #2:

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

input:

59

output:

5.0000000000

result:

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

Test #3:

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

input:

1

output:

1.4142135623

result:

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

Test #4:

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

input:

2

output:

1.4142135623

result:

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

Test #5:

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

input:

3

output:

1.4142135623

result:

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

Test #6:

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

input:

4

output:

1.4142135623

result:

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