Advertisement
raisul82

LIGHTOJ 1311 - Unlucky Bird

Jul 26th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. double v1,v2,v3,a1,a2,t1,t2,t,s1,s2,s,d;
  6. int T,i=0;
  7. scanf("%d",&T);
  8.  
  9. while(T-- && scanf("%lf%lf%lf%lf%lf",&v1,&v2,&v3,&a1,&a2)==5)
  10. {
  11. t1=v1/a1;
  12. t2=v2/a2;
  13. s1=(v1*t1)-(0.5*a1*t1*t1);
  14. s2=(v2*t2)-(0.5*a2*t2*t2);
  15. d=s1+s2;
  16. t=max(t1,t2);
  17. s=v3*t;
  18. printf("Case %d: %lf %lf\n",++i,d,s);
  19. }
  20. return 0;
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement