|
|
вернуться в форумfast solution with wrong idea Послано Baz 19 окт 2011 12:11 Got AC 0.015 with this magic code #define forn(i,n) for (int i = 0; i < (int)(n); i++) typedef long double ld; ld g = 9.81l; int main() { ld l, h, w; cin >> l >> h >> w; l /= 100, h /= 100, w *= acosl(0) / 15; ld t = 0; forn (i, 1000) { ld d = fabsl(sinl(w * t) * l / 2); //g x^2 /2 + (x-t)wl/2 + d = h //x^2 g/2 + x wl/2 - wlt/2+d-h = 0 t = (-w * l / 2 + sqrtl(w * w * l * l / 4 + 2 * g * (w * l * t / 2 - d + h))) / g; } cout << ((cosl(w * t) > 0) ? "butter": "bread"); } the next moment found the normal solution. Edited by author 19.10.2011 12:17 |
|
|