QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#207079 | #5152. Circular Caramel Cookie | Minhho | WA | 1ms | 3808kb | C++20 | 639b | 2023-10-08 07:26:36 | 2023-10-08 07:26:36 |
Judging History
answer
#define taskname "C"
#include <bits/stdc++.h>
#define ld long double
#define int long long
using namespace std;
inline int cal(ld x)
{
int le = trunc(x-1);
int wi = sqrt(x*x-le*le);
wi <<= 1;
le <<= 1;
return 2 * le * wi - min(le, wi) * min(le, wi);
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
int s; ld l = 0, r = 1e5;
cin>>s;
for (int i=1; i<=1000; i++)
{
ld m = (l+r)/2;
// cerr<<m<<" "<<cal(m)<<"\n";
if (cal(m) > s) r = m;
else l = m;
}
cout<<fixed<<setprecision(9)<<r;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3800kb
input:
11
output:
2.236067977
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
59
output:
5.000000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3808kb
input:
1
output:
2.000000000
result:
wrong answer 1st numbers differ - expected: '1.4142136', found: '2.0000000', error = '0.4142136'