QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#102555#5152. Circular Caramel Cookiew4p3r#WA 2ms3556kbC++20439b2023-05-03 14:35:542023-05-03 14:35:58

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-03 14:35:58]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3556kb
  • [2023-05-03 14:35:54]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
typedef double db;
const db eps=1e-12;
typedef long long ll;

int s=0;

bool check(db mid)
{
	ll cnt=0;
	db d=mid*mid;
	for(int i=1;i<=mid;i++)
		cnt+=(sqrt(d-1ll*i*i)+(1e-12));
	return 4*cnt>s;
}

int main()
{
	scanf("%d",&s);
	db l=0,r=sqrt(s);
	while(l+eps<=r)
	{
		db mid=l+(r-l)*0.5;
		if(check(mid)) r=mid;
		else l=mid;
	}
	printf("%.20lf\n",r);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3556kb

input:

11

output:

2.23606797749959440580

result:

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

Test #2:

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

input:

59

output:

4.99999999999963584685

result:

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

Test #3:

score: -100
Wrong Answer
time: 2ms
memory: 3512kb

input:

1

output:

1.00000000000000000000

result:

wrong answer 1st numbers differ - expected: '1.4142136', found: '1.0000000', error = '0.2928932'