QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#201478 | #5152. Circular Caramel Cookie | DreamOn# | WA | 1ms | 3884kb | C++23 | 835b | 2023-10-05 14:37:08 | 2023-10-05 14:37:08 |
Judging History
answer
#include<bits/stdc++.h>
#define db double
#define ll long long
#define eps 5e-9
using namespace std;
template<typename T>
inline void read( T &n )
{
n=0;bool w=false;char ch=getchar();
while( ch>'9' || ch<'0' ) w=!(ch^'-'),ch=getchar();
while( ch<='9' && ch>='0' ) n=(n<<3)+(n<<1)+(ch^48),ch=getchar();
n=w?-n:n;
}
namespace kk
{///////////
ll count( db r )
{
ll ret=0;
for(int i=floor(r);i>=1;i--)
{
int l=floor(sqrt(r*r-1ll*i*i));
while( 1ll*l*l+1ll*i*i>r*r ) l--;
while( 1ll*(l+1)*(l+1)+1ll*i*i<r*r ) l++;
ret+=l;
}
return ret<<2;
}
int s;
void solve()
{
read(s);
db l=1,r=1e5,ans;
while( r-l>=eps )
{
db mid=(l+r)/2;
if( count(mid)>=s )
ans=mid,r=mid;
else l=mid;
}
printf("%.8lf",ans);
}
}//////////
int main()
{
kk::solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3828kb
input:
11
output:
2.23606798
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3780kb
input:
59
output:
5.00000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
1
output:
1.41421356
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3784kb
input:
2
output:
1.41421356
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
3
output:
1.41421356
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3844kb
input:
4
output:
1.41421356
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'