QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#201524#5152. Circular Caramel CookieDreamOn#WA 1ms3904kbC++23849b2023-10-05 14:57:152023-10-05 14:57:16

Judging History

你现在查看的是最新测评结果

  • [2023-10-05 14:57:16]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3904kb
  • [2023-10-05 14:57:15]
  • 提交

answer

#include<bits/stdc++.h>
#define db long double
#define ll long long
#define eps 1e-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( double r )
{
	ll ret=0;
	for(ll i=r;i>=1;i--)
	{
		ll l=sqrt(r*r-i*i);
		while( l*l+i*i>r*r ) l--;
		while( (l+1)*(l+1)+i*i<r*r ) l++;
		ret+=l;
	}
	return ret<<2;
}


ll 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;
	}
    cout << fixed << setprecision(10);
	cout << ans << endl;
}

}//////////
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: 3796kb

input:

11

output:

2.2360679781

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3904kb

input:

59

output:

5.0000000002

result:

ok found '5.0000000', expected '5.0000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

1

output:

1.4142135626

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3864kb

input:

2

output:

1.4142135626

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

3

output:

1.4142135626

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #6:

score: -100
Wrong Answer
time: 1ms
memory: 3720kb

input:

4

output:

1.4142135626

result:

wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'