Advertisement
kirya_shkolnik

Зимовец - 5

Feb 24th, 2021
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. double VlozhCikl(double a, double b, double hx, double c, double d, double hy)
  8. {
  9.     int n = ceil((b-a)/hx)+1;
  10.     int m = ceil((d-c)/hy)+1;
  11.     double res = 0;
  12.     double x, y, z;
  13.     for(int i = 1; i<=n; ++i){
  14.         x = a+(i-1)*hx;
  15.         for(int j = 1; j<=m; ++j){
  16.             y = c+(j-1)*hy;
  17.             z = (pow(y, 1 / 4) / (3 * x));
  18.             if(z<0.0)res += z;
  19.         }
  20.     }
  21.     return res;
  22. }
  23. int main()
  24. {
  25.     double a, b, hx, c, d, hy;
  26.     cin >> a >> b >> hx >> c >> d >> hy;
  27.     double res = VlozhCikl(a, b, hx, c, d, hy);
  28.     cout << res;
  29. }
  30.  
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement