QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202728#5152. Circular Caramel CookieOrange_JuiCEWA 0ms3852kbC++171.2kb2023-10-06 13:13:022023-10-06 13:13:02

Judging History

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

  • [2023-10-06 13:13:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3852kb
  • [2023-10-06 13:13:02]
  • 提交

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 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;
    }
    dbg(ans);
    printf("%.10lf\n", sqrt(ans));
}

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

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3852kb

input:

11

output:

ans -> 5 
2.2360679775

result:

wrong output format Expected double, but "ans" found