QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#201926#5152. Circular Caramel CookieOrange_JuiCE#WA 0ms3968kbC++171.2kb2023-10-05 17:41:412023-10-05 17:41:41

Judging History

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

  • [2023-10-05 17:41:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3968kb
  • [2023-10-05 17:41:41]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define rep(a, b, c) for(int (a)=(b);(a)<=(c);(a)++)
#define per(a, b, c) for(int (a)=(b);(a)>=(c);(a)--)
#define mset(var, val) memset(var,val,sizeof(var))
#define ll long long
#define int ll
#define fi first
#define se second
#define no "No\n"
#define yes "Yes\n"
#define pb push_back
#define endl "\n"
#define pii pair<int,int>
#define pll pair<ll,ll>
#define dbg(x...) do{cout<<#x<<" -> ";err(x);}while (0)

void err() { cout << '\n'; }

template<class T, class... Ts>
void err(T arg, Ts... args) {
    cout << arg << ' ';
    err(args...);
}

int n, ans;

int calc(int rr) {
    int cnt=0;
    int r = sqrt(rr);
    for(int i = 1; i <= r; i++)
        cnt += sqrt(rr-i*i);
    return cnt*4;
}

void solve() {
    cin >> n;
    int sqn = sqrt(n);
    int l = 1, r = 2*n;
    while(l <= r) {
        int mid = (l+r)>>1;
        if(calc(mid) >= n) ans = mid, r = mid-1;
        else l = mid+1;
    }
    printf("%.10lf\n", sqrt(ans));
}

signed main() {
    IOS;
    int T = 1;
    while (T--) {
        solve();
    }
    return 0;
}

詳細信息

Test #1:

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

input:

11

output:

2.2360679775

result:

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

Test #2:

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

input:

59

output:

5.0000000000

result:

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

Test #3:

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

input:

1

output:

1.4142135624

result:

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

Test #4:

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

input:

2

output:

1.4142135624

result:

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

Test #5:

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

input:

3

output:

1.4142135624

result:

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

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 3840kb

input:

4

output:

1.4142135624

result:

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