QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#501225 | #5152. Circular Caramel Cookie | naichakafei | WA | 1ms | 3884kb | C++20 | 989b | 2024-08-02 15:47:56 | 2024-08-02 15:48:01 |
Judging History
answer
/*
/\_/\
(= ._.)
/ > \>
*/
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cstdio>
#include <cmath>
#include <cassert>
#define int long long
#define double long double
using namespace std;
const int N = 4e5 + 10, M = 1e6 + 10, MOD = 1e9 + 7;
int a[N];
pair<int, int> b[N];
int check(double r) {
int ans = 0;
for (int i = 1; i <= r; i++) {
int x = i, y = sqrt(r * r - x * x);
ans += y;
}
return ans * 4;
}
void solve() {
int n;
cin >> n;
double l = 0, r = 1e5;
while (r - l > 1e-10) {
double mid = (r + l) / 2;
if (check(mid) >= n) {
r = mid;
} else {
l = mid;
}
}
printf("%.10Lf", l);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int TT = 1;
//cin >> TT;
while (TT--) {
solve();
}
return 0;
}
/*
/\_/\
(= ._.)
/ > \>
*/
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3876kb
input:
11
output:
2.2360679774
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
59
output:
5.0000000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
1
output:
1.4142135623
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
2
output:
1.4142135623
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
3
output:
1.4142135623
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 3712kb
input:
4
output:
1.4142135623
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'