Advertisement
kirya_shkolnik

Давид 3 задача

Mar 24th, 2022
688
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3.  
  4. using namespace std;
  5.  
  6. double branch(double x, double b, double c){
  7.     double d = 0;
  8.     if(x>=0 && x<=1){
  9.         d = cos(1-(c*pow(x,2)/b));
  10.         if(d < pow(sin(x), 2)){
  11.             d = pow(sin(x), 2);
  12.         }
  13.     }
  14.     else{
  15.         if( x > 1){
  16.             d = c;
  17.             if(d < x){
  18.                 d = x;
  19.             }
  20.            
  21.             double d1 = sqrt(x);
  22.             if(d1 > sqrt(b) + c){
  23.                 d1 = sqrt(b) + c;
  24.             }
  25.            
  26.             if(d < d1){
  27.                 d = d1;
  28.             }
  29.         }
  30.         else{
  31.             d = exp(b*x+c);
  32.         }
  33.     }
  34.     return d;
  35. }
  36.  
  37. int main(){
  38.     double x, b, c, d;
  39.     cin >> x >> b >> c;
  40.     d = branch(x,b,c);
  41.     cout << d;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement