QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#96634 | #5152. Circular Caramel Cookie | Mostafa_Moharram | WA | 2ms | 3484kb | C++14 | 794b | 2023-04-14 22:20:08 | 2023-04-14 22:20:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ld = long double;
int s;
//
// SSSS
bool inside(ld r, int x, int y) {
return 1ll * x * x + 1ll * y * y <= r * r + 1e-8l;
}
int check(ld r) {
int rm = 0;
int x = r;
int y = 1;
while (x > 0) {
while (x > 0 and not inside(r, x, y))
--x;
rm += x;
++y;
}
return 4 * rm;
}
signed main() {
ios::sync_with_stdio(false); cout.tie(nullptr); cin.tie(nullptr);
// cout << check(1.41421356237l);
cin >> s;
ld l = 0, r = 2 * sqrtl(s);
for (int _ = 0; _ < 100; ++_) {
ld m = (l + r) / 2;
if (check(m))
r = m;
else l = m;
}
cout << fixed << setprecision(12) << l << '\n';
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3484kb
input:
11
output:
1.414213558838
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'