QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#226783#5152. Circular Caramel CookieFyind#WA 1ms3896kbC++23854b2023-10-26 16:11:292023-10-26 16:11:29

Judging History

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

  • [2023-10-26 16:11:29]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3896kb
  • [2023-10-26 16:11:29]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define _ <<" "<<
#define sz(x) ((int) (x).size())
typedef pair<int, int> pii;
typedef long long ll;
const int maxn = 1e5 + 5;

const long double eps = 1e-13;
int n, m;
ll s; 

// ll calc(long double x, ll i) {
//     ll ret = 0;
//     while ()
// }

bool check(long double x) {
    if (x >= maxn) return true;
    ll cur = 0;
    ll up = int(x + eps);
    for (ll i = 1;i <= up; ++i) {
        cur += (ll)(sqrt(x*x - i*i) + eps); 
    }
    cur *= 4;
    return cur >= s;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> s;
    long double L = 1, R = INT_MAX;
    while (R-L > eps) {
        long double M = (L+R)/2;
        if (check(M)) R = M;
        else L = M;
    }
    cout << fixed << setprecision(8) << L << '\n';
    return 0;
}

詳細信息

Test #1:

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

input:

11

output:

2.23606798

result:

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

Test #2:

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

input:

59

output:

5.00000000

result:

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

Test #3:

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

input:

1

output:

1.41421356

result:

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

Test #4:

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

input:

2

output:

1.41421356

result:

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

Test #5:

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

input:

3

output:

1.41421356

result:

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

Test #6:

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

input:

4

output:

1.41421356

result:

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