Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define eps 1e-9
- int main(){
- #ifdef ERFANUL007
- clock_t tStart = clock();
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- double k, l, s, w, g = 9.81, vsq;
- while(cin >> k >> l >> s >> w){
- if(k + l + s + w < eps) break;
- double dis = max(0.0, s-l);
- vsq = 2.0 * g * s - k * dis * dis / w;
- if(vsq < -eps) cout << "Stuck in the air.\n";
- else if(vsq <= 100.0) cout << "James Bond survives.\n";
- else cout << "Killed by the impact.\n";
- }
- #ifdef ERFANUL007
- fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
- #endif
- return 0;
- }
- /*
- F = ma
- F * s = 0.5 * m * v * v
- m * a * s = 0.5 * m * v * v
- v * v = 2 * a * s
- F * s = 0.5 * k * dl * dl (dl = v)
- v * v = k * dl * dl / m
- so v * v = 2 * a * s - k * dl * dl
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement