QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#201254 | #5152. Circular Caramel Cookie | Delay_for_five_minutes# | WA | 0ms | 3924kb | C++20 | 507b | 2023-10-05 13:23:30 | 2023-10-05 13:23:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const double eps = 5e-7;
long long get(double s)
{
long long ans = 0;
double p = s * s;
for(int i = 1;i <= s;i++) {
ans += 4*((int)(sqrt(p - i*i))) ;
}
return ans;
}
int main()
{
int s;cin >> s;
double l = 0 , r = sqrt(s) + 10;
while((r - l) / l > eps) {
double md = (l + r) / 2;
if(get(md) >= s) r = md;
else l = md;
}
printf("%.12lf\n",(l + r) / 2);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3804kb
input:
11
output:
2.236067620096
result:
ok found '2.2360676', expected '2.2360680', error '0.0000002'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
59
output:
5.000000711943
result:
ok found '5.0000007', expected '5.0000000', error '0.0000001'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
1
output:
1.414213508368
result:
ok found '1.4142135', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
2
output:
1.414213874353
result:
ok found '1.4142139', expected '1.4142136', error '0.0000002'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
3
output:
1.414213489877
result:
ok found '1.4142135', expected '1.4142136', error '0.0000001'
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3920kb
input:
4
output:
1.414213478565
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142135', error = '0.3675445'