QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#501310 | #5152. Circular Caramel Cookie | EdisonBa | TL | 0ms | 0kb | C++14 | 1.5kb | 2024-08-02 16:37:02 | 2024-08-02 16:37:03 |
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;
ld l = 0.0, r = 100000.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;
}
详细
Test #1:
score: 0
Time Limit Exceeded
input:
11