QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#201385 | #5151. Bottle Flip | salvator_noster# | WA | 0ms | 3856kb | C++14 | 1.1kb | 2023-10-05 14:03:11 | 2023-10-05 14:03:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef double db;
db h, r, da, dw;
db calc(db t) {
db t1 = t * t / 2 * dw + (h * h - t * t) / 2 * da;
db t2 = t * dw + (h - t) * da;
return t1 / t2;
}
int main(void) {
scanf("%lf%lf%lf%lf", &h, &r, &da, &dw);
printf("%lf %lf\n", calc(0), calc(h));
double t1 = h * h * da * da / (dw - da) / (dw - da);
double t2 = h * h * da / (dw - da);
double t3 = sqrt(t1 + t2);
double t4 = h * da / (dw - da);
double t = t3 - t4;
printf("%.10f\n", t);
// db le = 0.0, ri = r, ans = -1;
// for (int i = 1; i <= 10; ++i) {
// ans = (le + ri) / 2;
// db step = (ri - le) / 3;
// db t1 = le + step, t2 = ri - step;
// db num1 = calc(t1), num2 = calc(t2);
// printf("t1 = %lf, t2 = %lf, num1 = %lf, num2 = %lf\n", t1, t2, num1,
// num2);
// if (num1 < num2) {
// ri = t2;
// } else {
// le = t1;
// }
// }
// printf("%.10f\n", ans);
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3856kb
input:
22 4 1 4
output:
11.000000 11.000000 7.3333333333
result:
wrong answer 1st numbers differ - expected: '7.3333333', found: '11.0000000', error = '0.5000000'