QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#96440 | #5152. Circular Caramel Cookie | IsaacMoris# | WA | 4ms | 3752kb | C++14 | 835b | 2023-04-13 21:31:52 | 2023-04-13 21:32:11 |
Judging History
answer
#include<iostream>
#include <bits/stdc++.h>
# define ld long double
#define ll long long
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 1e6 + 5, mod = 998244353, M = 17;
ll solve(ld r) {
// x^2 + y^2 <= r2
ll ans = 0;
r += 1e-14;
for (int i = -r; i <= r; i++) {
if (i == 0)continue;
int y = sqrt(r * r - 1ll * i * i);
ans += 2 * y;
}
return ans;
}
void doWork() {
int s;
cin >> s;
ld ans = 0;
for (ld i = 2e4; i >= 1e-9; i /= 2) {
while (solve(ans + i) < s) {
ans += i;
}
}
cout << fixed << setprecision(9) << ans + 1e-8;
}
int main() {
IO
int t = 1;
// cin >> t;
for (int i = 1; i <= t; i++) {
doWork();
}
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 3704kb
input:
11
output:
2.236067987
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
59
output:
5.000000010
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3608kb
input:
1
output:
1.414213571
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
2
output:
1.414213571
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 4ms
memory: 3620kb
input:
3
output:
1.414213571
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 2ms
memory: 3640kb
input:
4
output:
1.414213571
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'