Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
参考代码#include<stdio.h> #include<math.h> #define g 9.81 int main() { double m,h,l,k; double v; while(scanf("%lf%lf%lf%lf",&k,&l,&h,&m)) { if(!k && !l && !h && !m) return 0; if(l>=h) { v=sqrt((double)h*2*g); if(v<=10) { printf("James Bond survives.\n"); } else printf("Killed by the impact.\n"); continue; } else if(l<h) { if(k/2*(h-l)*(h-l)>m*g*h) { printf("Stuck in the air.\n"); continue; } v=sqrt(2.0*g*h-k*(h-l)*(h-l)/m); if(v<=10) { printf("James Bond survives.\n"); } else printf("Killed by the impact.\n"); continue; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator