QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#677274 | #5152. Circular Caramel Cookie | wifi32767 | WA | 1ms | 3924kb | C++20 | 684b | 2024-10-26 10:53:48 | 2024-10-26 10:53:52 |
Judging History
answer
#include<bits/stdc++.h>
using ll = long long;
#define endl '\n'
// #define int long long
using namespace std;
const int MAX = 2e5 + 5;
ll check(double x){
ll res = 0;
for (double i = 1; i <= x; i ++){
res += floor(sqrt(x * x - i * i));
}
res *= 4ll;
return res;
}
void solve(){
ll s;
cin >> s;
double lk = 0.0, rk = 1e5;
while (rk - lk > 1e-7){
double mid = (lk + rk) / 2;
if (check(mid) >= s) rk = mid;
else lk = mid;
}
cout << lk;
}
signed main(){
ios::sync_with_stdio(0);cin.tie(0);
cout << fixed << setprecision(10);
// int T=1;cin>>T;while(T--)
solve();
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3756kb
input:
11
output:
2.2360679395
result:
ok found '2.2360679', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
59
output:
4.9999999646
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
1
output:
1.4142135115
result:
ok found '1.4142135', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3724kb
input:
2
output:
1.4142135115
result:
ok found '1.4142135', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3784kb
input:
3
output:
1.4142135115
result:
ok found '1.4142135', expected '1.4142136', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 3924kb
input:
4
output:
1.4142135115
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142135', error = '0.3675445'