QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#196884 | #5152. Circular Caramel Cookie | RobeZH# | WA | 1ms | 3928kb | C++14 | 860b | 2023-10-02 02:38:17 | 2023-10-02 02:38:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define subnb true
#define Lnb true
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
int s;
bool check(ld r) {
int fr = r;
ll res = 0;
for (int i = 1; i <= r; i++) {
int h = int(sqrt(r * r - i * i));
res += 1LL * h * 4;
}
return res >= s;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> s;
ld l = 0, r = 1e5, mid;
rep(it, 0, 50) {
mid = (l + r) / 2;
if(check(mid)) r = mid;
else l = mid;
}
cout << fixed << setprecision(10) << r << '\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3732kb
input:
11
output:
2.2360679775
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3928kb
input:
59
output:
5.0000000001
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
1
output:
1.4142135624
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
2
output:
1.4142135624
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3924kb
input:
3
output:
1.4142135624
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 3924kb
input:
4
output:
1.4142135624
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'