QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#202728 | #5152. Circular Caramel Cookie | Orange_JuiCE | WA | 0ms | 3852kb | C++17 | 1.2kb | 2023-10-06 13:13:02 | 2023-10-06 13:13:02 |
Judging History
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