[ AGC007 C ] Pushing Balls
题目
思路
发现这样的笔太骚, 不适合写题解, 以后不会用了
代码
#include <iostream>
using namespace std;
int n, x, d;
signed main() {
cin >> n >> d >> x;
double ad = d, ax = x, bd, bx, res = 0;
while (n) {
res += ad + n * ax - ax / 2;
bd = ((2.0 * ad + 5.0 * ax) / (2.0 * n)) + ad;
bx = ax + (4.0 * ax) / (2.0 * n);
ax = bx, ad = bd, n--;
}
printf("%.10f\n", res);
return 0;
}