QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501313 | #5152. Circular Caramel Cookie | EdisonBa | TL | 327ms | 3940kb | C++14 | 1.5kb | 2024-08-02 16:39:01 | 2024-08-02 16:39:02 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ld long double
typedef long long ll;
#define re read()
#define INF 9223372036854775800
#define fr(i, x, y) for(int i = x, p = y; i <= p; ++i)
#define rp(i, x, y) for(int i = x, p = y; i >= p; --i)
#define Timeok ((double)clock() / CLOCKS_PER_SEC < MAX_TIME)
const double MAX_TIME = 1.0 - 0.0032;
inline ll read()
{
ll x = 0, f = 0;
char ch = getchar();
while (!isdigit(ch))
f |= (ch == '-'), ch = getchar();
while (isdigit(ch))
x = (x << 1) + (x << 3) + (ch ^= 48), ch = getchar();
return f ? -x : x;
}
void write(ll x)
{
if (x < 0)
putchar('-'), x = -x;
if (x > 9)
write(x / 10);
putchar(x % 10 + 48);
}
inline void W(ll x, char ch)
{
write(x);
putchar(ch);
}
/*------------C-O-D-E------------*/
const int N = 1e5 + 4;
ll n, m, T;
ld ju(ll x, ll y)
{
return (ld)sqrt(x*x+y*y);
}
bool Check(ld r)
{
ll ans = 0;
fr(i, 1, r)
{
rp(j, r, 1)
{
if(ju(i, j) <= r + 0.000000001) {
ans += 4 * j;
break;
}
}
}
return ans >= n;
}
int main()
{
n = re;
++n;
ld l = 0.0, r = 50000.0, eps = 1e-8;
ld mid;
while(r - l > eps)
{
mid = (l + r) / 2.0;
if(Check(mid))
{
r = mid;
}
else l = mid;
}
printf("%.10Lf\n", mid);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 324ms
memory: 3800kb
input:
11
output:
2.2360679793
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 323ms
memory: 3816kb
input:
59
output:
5.0000000044
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 323ms
memory: 3800kb
input:
1
output:
1.4142135626
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 327ms
memory: 3940kb
input:
2
output:
1.4142135626
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 323ms
memory: 3940kb
input:
3
output:
1.4142135626
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: 0
Accepted
time: 324ms
memory: 3900kb
input:
4
output:
2.2360679793
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #7:
score: -100
Time Limit Exceeded
input:
1000000000