Advertisement
kirya_shkolnik

Инф Екз

Feb 24th, 2021
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.24 KB | None | 0 0
  1. // 1. Start
  2. #include <iostream>
  3. #include <cmath>
  4. double bisectrix (double a, double b, double c){
  5.     double La = (sqrt(b*c*((b+c)*(b+c)-a*a)/(b+c);
  6.     return La;
  7. }
  8.  
  9. int main(){
  10.     double a,b,c;
  11.     cin>>a>>b>>c;
  12.     double La = bisectrix(a,b,c),
  13.            Lb = bisectrix(b,c,a),
  14.            Lc = bisectrix(c,a,b);
  15.     cout << La << Lb << Lc;
  16. }
  17. // 1. End
  18.  
  19. // 2. Start
  20. #include <iostream>
  21. #include <cmath>
  22. void Razv(double x, double& t){
  23.     if(x<=0.0){
  24.         t=x*x;
  25.         double temp = sin(x*x);
  26.         double temp1 = log(x);
  27.         if(temp>t) t = temp;
  28.         if(temp1>t) t = temp1;
  29.     }
  30.     if(x>=4.0){
  31.         t=sqrt(abs(x));
  32.         double temp = exp(-x);
  33.         double temp1 = cos(x)*cos(x)*cos(x);
  34.         double temp2 = sin(x*x*x);
  35.         double temp3 = pow(2*x,1.0/3.0);
  36.         if(temp<t) t = temp;
  37.         if(temp1<t) t = temp1;
  38.         if(temp2<t) t = temp2;
  39.         if(temp3<t) t = temp3;
  40.     }
  41.     if(x>0.0 and x<4.0) t = 1;
  42. }
  43. int main(){
  44.     double x,t;
  45.     cin >> x;
  46.     Razv(x,t);
  47.     cout << t;
  48. }
  49.  
  50. // 2. End
  51.  
  52. // 3. Start
  53. void Calc(double x, double epsilon, double& res){
  54.     double a = - x*x*x*x/2;
  55.     int i = 1;
  56.     while(abs(a) > epsilon){
  57.         res+=a;
  58.         i++;
  59.         a*= - (x*x) / ( (3*i-1) * (3*i-2) * (3*i-3) );
  60.     }
  61. }
  62. int main() {
  63.     double x,res,epsilon;
  64.     res = 0;
  65.     cin >> x >> epsilon;
  66.     Calc(x,epsilon, res);
  67.     cout << res;
  68. }
  69. // 3. End
  70.  
  71. // 4. Start
  72. #include <iostream>
  73. #include <cmath>
  74. double func(double x) {
  75.     return (cos(10.5*x - 3));
  76. }
  77. void RegCikl(double a, double b, double h, int& count){
  78.     double x,y;
  79.     int n = ceil((b-a)/h)+1;
  80.     for (int i = 1; i<=n; ++i){
  81.         x = a+(i-1)*h;
  82.         y = func(x);
  83.         if(y>0.0) count++;
  84.     }
  85. }
  86.  
  87. int main() {
  88.     double a,b,h;
  89.     int count = 0;
  90.     RegCikl(a,b,h,count);
  91.     cout << count;
  92. }
  93.  
  94. // 4. End
  95.  
  96. // 5. Start
  97. #include <iostream>
  98. #include <cmath>
  99. double func (double x, double y){
  100.     return (x*y*y+exp(-2*x));
  101. }
  102. double VlozhCikl (double a, double b, double hx, double c, double d, double dy, double& max){
  103.     int n = ceil((b-a)/hx)+1;
  104.     int m = ceil((d-c)/hy)+1;
  105.     double x,y,z,sum=0;
  106.     for(int i = 1; i<=n; ++i){
  107.         x = a+(i-1)*hx;
  108.         for(int j = 1; j<=m; ++j){
  109.             y = c+(j-1)*hy;
  110.             z = func(x,y);
  111.             if(z>max) max = z;
  112.             sum += z;
  113.         }
  114.     }
  115.     return sum;
  116. }
  117. int main(){
  118. double a,b,hx,c,d,hy,max = -1.7e308;
  119. double sum = VlozhCikl(a,b,hx,c,d,hy,max);
  120. cout << sum << max;
  121. }
  122.  
  123. // END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement