QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#196884#5152. Circular Caramel CookieRobeZH#WA 1ms3928kbC++14860b2023-10-02 02:38:172023-10-02 02:38:17

Judging History

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

  • [2023-10-02 02:38:17]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3928kb
  • [2023-10-02 02:38:17]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define subnb true
#define Lnb true
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

int s;

bool check(ld r) {
    int fr = r;
    ll res = 0;
    for (int i = 1; i <= r; i++) {
        int h = int(sqrt(r * r - i * i));
        res += 1LL * h * 4;
    }
    return res >= s;
}

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

    cin >> s;
    ld l = 0, r = 1e5, mid;
    rep(it, 0, 50) {
        mid = (l + r) / 2;
        if(check(mid)) r = mid;
        else l = mid;
    }
    cout << fixed << setprecision(10) << r << '\n';

}

詳細信息

Test #1:

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

input:

11

output:

2.2360679775

result:

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

Test #2:

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

input:

59

output:

5.0000000001

result:

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

Test #3:

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

input:

1

output:

1.4142135624

result:

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

Test #4:

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

input:

2

output:

1.4142135624

result:

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

Test #5:

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

input:

3

output:

1.4142135624

result:

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

Test #6:

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

input:

4

output:

1.4142135624

result:

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