v 0. Pasted by slipstak2 as cpp at 2011-01-11 14:12:54 MSK and set expiration to never.

Paste will expire never.

  1. // Меньшиков. Тренировка 14.
  2. // 14B. Д-44 [d44]
  3. // ibelyaev: 10Jan2011
  4.  
  5. #include <iostream>
  6. #include <cstdio>
  7. #include <cmath>
  8.  
  9. using namespace std;
  10. const double k = 0.0008137;
  11. const double V0 = 800;
  12. const double m = 9.6;
  13. const double g = 9.8;
  14. const double pi = 2*acos(0.0);
  15.  
  16.  
  17. double alpha;
  18. void input()
  19. {
  20.     cin>>alpha;
  21.     alpha = pi * alpha / 180.0;
  22. }
  23. void solve()
  24. {
  25.     double dt = 0.0001;
  26.     double Vxt = V0 * cos(alpha);
  27.     double Vyt = V0 * sin(alpha);
  28.     double Xt = Vxt * dt;
  29.     double Yt = Vyt * dt;
  30.     double Vt,Xnext,Ynext,Axt,Ayt,Frxt,Fryt,Frt;
  31.     do
  32.     {
  33.         Vt = sqrt(Vxt*Vxt + Vyt*Vyt);
  34.         Xnext = Xt + Vxt*dt;
  35.         Ynext = Yt + Vyt*dt;
  36.  
  37.         Frt = k * Vt * Vt;
  38.         Frxt = - Frt * Vxt / Vt;
  39.         Fryt = - Frt * Vyt / Vt;
  40.  
  41.         Axt = Frxt / m;
  42.         Ayt = Fryt / m - g;
  43.  
  44.         Vxt = Vxt + Axt * dt;
  45.         Vyt = Vyt + Ayt * dt;
  46.  
  47.         Xt = Xnext;
  48.         Yt = Ynext;
  49.     }while (Yt>=0);
  50.  
  51.     printf("%0.0f",Xt);
  52. }
  53. int main()
  54. {
  55.     freopen("input.txt","r",stdin);
  56.     freopen("output.txt","w",stdout);
  57.  
  58.     input();
  59.     solve();
  60.     return 0;
  61. }


Editing is locked.