QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#96427 | #5152. Circular Caramel Cookie | RoomGamadan# | WA | 2ms | 3748kb | C++20 | 1.4kb | 2023-04-13 21:21:10 | 2023-04-13 21:21:11 |
Judging History
answer
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define el '\n'
#define F first
#define S second
typedef long long ll;
typedef long double ld;
bool multipleTestCases = 0, sublime = 0;
const int N = 4e5 + 5, INF = 1e9 + 5, mod = 1e9 + 7, LOG = 22, SQ = 500;
void doWork() {
ll n;
cin >> n;
ll s = 2, e = 1e6, m, ans = 1e6;
while (s <= e) {
m = (s + e) >> 1;
ll block = (m + 1) / 2;
ll val = (2 * block) * (2 * block);
if (m % 2) {
val -= 4;
}
if (val > n) {
ans = m;
e = m - 1;
}
else {
s = m + 1;
}
}
ll block = (m + 1) / 2;
cout << setprecision(12);
if (ans % 2 == 0) {
cout << sqrtl(block * block + block * block) << el;
}
else {
cout << sqrtl((block - 1) * (block - 1) + block * block) << el;
}
}
signed main() {
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#endif
#ifndef ONLINE_JUDGE
if (sublime) {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
}
#endif
int tests = 1;
if (multipleTestCases) {
cin >> tests;
}
for (int tc = 1; tc <= tests; tc++) {
doWork();
}
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3612kb
input:
11
output:
2.2360679775
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
59
output:
5
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3700kb
input:
1
output:
1.41421356237
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
2
output:
1.41421356237
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
3
output:
1.41421356237
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
4
output:
2.2360679775
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #7:
score: -100
Wrong Answer
time: 2ms
memory: 3748kb
input:
1000000000
output:
22360.8377526
result:
wrong answer 1st numbers differ - expected: '17841.8813190', found: '22360.8377526', error = '0.2532780'