fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. double S, V, T;
  7. const double g = 10;
  8.  
  9. cin >> S >> V >> T;
  10.  
  11. double rad = S * M_PI / 180.0;
  12. double Vx = V * cos(rad);
  13. double Vy = V * sin(rad);
  14.  
  15. // Waktu total sampai menyentuh tanah
  16. double t_total = (Vy + sqrt(Vy * Vy + 2 * g * T)) / g;
  17.  
  18. // Jarak horizontal terjauh
  19. double jarak = Vx * t_total;
  20.  
  21. cout.setf(ios::fixed);
  22. cout.precision(2);
  23. cout << jarak << endl;
  24.  
  25. return 0;
  26. }
  27.  
  28.  
  29.  
Success #stdin #stdout 0s 5320KB
stdin
37
100
100
stdout
1079.44