QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#201303#5152. Circular Caramel CookieBoulevardDust#WA 1ms3744kbC++20549b2023-10-05 13:37:252023-10-05 13:37:25

Judging History

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

  • [2023-10-05 13:37:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3744kb
  • [2023-10-05 13:37:25]
  • 提交

answer

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

long double h, r, A, W;
long double calc(long double x) {
	long double n1 = x * x * W + (h * h - x * x) * A;
	long double n2 = x * W + (h - x) * A;
	return n1 / n2;
}

int main() {
	scanf("%Lf%Lf%Lf%Lf", &h, &r, &A, &W);
	long double l = 0, r = h;
	for (int i = 1; i <= 200; ++i) {
		long double m1 = (l + l + r) / 3;
		long double m2 = (l + r + r) / 3;
		if (calc(m1) > calc(m2)) l = m1;
		else r = m2;
		printf("%.12Lf %.12Lf\n", l, r);
	}
	printf("%.12Lf\n", l);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3744kb

input:

11

output:

0.000000000000 7.333333333333
0.000000000000 4.888888888889
0.000000000000 3.259259259259
0.000000000000 2.172839506173
0.000000000000 1.448559670782
0.000000000000 0.965706447188
0.000000000000 0.643804298125
0.000000000000 0.429202865417
0.000000000000 0.286135243611
0.000000000000 0.190756829074
...

result:

wrong answer 1st numbers differ - expected: '2.2360680', found: '0.0000000', error = '1.0000000'