QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#208319#5152. Circular Caramel CookieAeren#WA 2ms3932kbC++20631b2023-10-09 13:36:042023-10-09 13:36:05

Judging History

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

  • [2023-10-09 13:36:05]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3932kb
  • [2023-10-09 13:36:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

#define ll long long

int main()
{
	cin.tie(0)->sync_with_stdio(false);
	cin.exceptions(ios::badbit | ios::failbit);
	cout << fixed << setprecision(15);
	int th;
	cin >> th;
	auto cnt = [&](double r){
		long long res = 0;
		for(auto x = 1; x <= r; ++ x){
			res += (int)sqrt(max(0.0, r * r - 1.0 * x * x));
		}
		return 4 * res;
	};
	double low = 0, high = 1000000;
	for(auto rep = 300; rep > 0; -- rep){
		double mid = (low + high) / 2;
		if(cnt(mid) < th){
			low = mid;
		}
		else{
			high = mid;
		}
	}
	cout << (low + high) / 2 << "\n";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3932kb

input:

11

output:

2.236067977499790

result:

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

Test #2:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

59

output:

5.000000000000000

result:

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

Test #3:

score: 0
Accepted
time: 2ms
memory: 3932kb

input:

1

output:

1.414213562373095

result:

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

Test #4:

score: 0
Accepted
time: 2ms
memory: 3932kb

input:

2

output:

1.414213562373095

result:

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

Test #5:

score: 0
Accepted
time: 2ms
memory: 3920kb

input:

3

output:

1.414213562373095

result:

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

Test #6:

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

input:

4

output:

1.414213562373095

result:

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