QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96465#5152. Circular Caramel CookieIsaacMoris#WA 2ms3632kbC++14933b2023-04-13 21:46:412023-04-13 21:46:43

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-13 21:46:43]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3632kb
  • [2023-04-13 21:46:41]
  • 提交

answer

#include<iostream>
#include <bits/stdc++.h>

# define ld   double
#define ll long long
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 1e6 + 5, mod = 998244353, M = 17;

ll solve(ld r) {
    // x^2 + y^2 <= r2
    ll ans = 0;
    for (int i = -r; i <= r; i++) {
        if (i == 0)continue;

        int y = sqrtl(max(r * r - 1ll * i * i, (ld) 0));
        ans += 2 * y;
    }
    return ans;
}

void doWork() {
    int s;
    cin >> s;
    ld low = sqrt(s / acos(-1));
    ld high = low + 1;
    for (int i = 0; i < 100; i++) {
        ld mid = (low + high) / 2;
        if (solve(mid) <= s) {
            low = mid;
        } else {
            high = mid;
        }
    }
    cout << fixed << setprecision(9) << low;
}

int main() {
    IO
    int t = 1;
    //  cin >> t;
    for (int i = 1; i <= t; i++) {
        doWork();
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3608kb

input:

11

output:

2.236067977

result:

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

Test #2:

score: 0
Accepted
time: 2ms
memory: 3624kb

input:

59

output:

5.000000000

result:

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

Test #3:

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

input:

1

output:

1.414213562

result:

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

Test #4:

score: 0
Accepted
time: 2ms
memory: 3624kb

input:

2

output:

1.414213562

result:

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

Test #5:

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

input:

3

output:

1.414213562

result:

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

Test #6:

score: -100
Wrong Answer
time: 2ms
memory: 3628kb

input:

4

output:

2.128379167

result:

wrong answer 1st numbers differ - expected: '2.2360680', found: '2.1283792', error = '0.0481599'