Advertisement
kirya_shkolnik

Кама - 2

Apr 6th, 2021 (edited)
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6. double Razv(double x,double y, double c, double d, int& vetka){
  7.     double z;
  8.    
  9.     if(x * y > 3.0){
  10.         z=x*x*x;
  11.         double temp = pow(log(x*y),c*d);
  12.         if(temp>z) z = temp;
  13.         vetka = 1;
  14.     }
  15.     if(x*y >= 0.0 && x*y <= 3.0){
  16.         z=x;
  17.         double temp = y;
  18.         double temp1;
  19.        
  20.         double tempmax1 = c*x;
  21.         double tempmax2 = d*y;
  22.         if(tempmax1 > tempmax2) temp1 = tempmax1;
  23.         else temp1 = tempmax2;
  24.        
  25.         if(temp < z) z = temp;
  26.         if(temp1 < z) z = temp1;
  27.        
  28.         z*=3;
  29.         vetka = 2;
  30.     }
  31.     if(x<0.0){
  32.         z = pow(2,c*d) - x;
  33.         vetka = 3;
  34.     }
  35.     return z;
  36. }
  37. int main(){
  38.     double x,y,c,d,z;
  39.     int vetka = 0;
  40.     cin >> x >> y >> c >> d;
  41.     z = Razv(x,y,c,d, vetka);
  42.     cout << "Ответ:" <<  z << endl << "Ветка:" << vetka;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement