QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501511#5152. Circular Caramel CookieziripoWA 23ms3976kbC++20404b2024-08-02 19:52:012024-08-02 19:52:01

Judging History

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

  • [2024-08-02 19:52:01]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:3976kb
  • [2024-08-02 19:52:01]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

bool check(double mid, double s) {
	int sum = 0;
	for (int i = 1; i < mid; i++)
		sum += sqrtf(mid * mid - i * i);
	sum *= 4;
	return sum <= s;
}

int main() {
	double s; cin >> s;
	double l = 1, r = 1e5;
	while (l < r - (double)1e-8) {
		double mid = (l + r) / 2;
		if (check(mid, s))l = mid;
		else r = mid;
	}
	printf("%.10f", l);
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3916kb

input:

11

output:

2.2360679504

result:

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

Test #2:

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

input:

59

output:

4.9999996662

result:

ok found '4.9999997', expected '5.0000000', error '0.0000001'

Test #3:

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

input:

1

output:

1.4142135498

result:

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

Test #4:

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

input:

2

output:

1.4142135498

result:

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

Test #5:

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

input:

3

output:

1.4142135498

result:

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

Test #6:

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

input:

4

output:

2.2360679390

result:

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

Test #7:

score: -100
Wrong Answer
time: 23ms
memory: 3976kb

input:

1000000000

output:

99999.9999999943

result:

wrong answer 1st numbers differ - expected: '17841.8813190', found: '100000.0000000', error = '4.6047901'