Advertisement
Guest User

Task10

a guest
Oct 15th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.96 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. //zadacha 10
  4. int main() {
  5. // a
  6.     double n;
  7.    
  8.     cin >> n;
  9.  
  10.     bool task = (n / 3 && n / 5 || n / 2 && n / 7);
  11.     cout << boolalpha << task << endl;
  12.     return 0;
  13. //b
  14.     double a, b, c;
  15.  
  16.     cin >> a;
  17.     cin >> b;
  18.     cin >> c;
  19.    
  20.     double discriminant = (b * b) - 4 * a * c;
  21.  
  22.     bool task = (discriminant >= 0);
  23.     cout << boolalpha << task << endl;
  24.     return 0;
  25. //v
  26.     double a, b, radius = 5;
  27.  
  28.     cin >> a;
  29.     cin >> b;
  30.  
  31.     bool task = (a == -1 && b == 2 && radius == 5);
  32.     cout << boolalpha << task << endl;
  33.     return 0;
  34. //g
  35.     double x, y, radius;
  36.  
  37.     cin >> x;
  38.     cin >> y;
  39.     cin >> radius;
  40.  
  41.  
  42.     bool task = (x > 0 && y > 0 && radius == 7);
  43.     cout << boolalpha << task << endl;
  44.     return 0;
  45. //d
  46.     double x, y, radius1, radius2;
  47.  
  48.     cin >> x;
  49.     cin >> y;
  50.     cin >> radius1;
  51.     cin >> radius2;
  52.  
  53.  
  54.     bool task = (x != 0 && y != 0 && radius1 != 1 && radius2 != 5);
  55.     cout << boolalpha << task << endl;
  56.     return 0;
  57. //e
  58.     double startPoint, endPoint, x;
  59.  
  60.     cin >> startPoint;
  61.     cin >> endPoint;
  62.     cin >> x;
  63.  
  64.  
  65.     bool task = (x >= startPoint && x <= endPoint);
  66.     cout << boolalpha << task << endl;
  67.     return 0;
  68. //j
  69.     double a, b, c, x;
  70.     cin >> a;
  71.     cin >> b;
  72.     cin >> c;
  73.     cin >> x;
  74.     double smallestFromABC;
  75.     if (fmin(a,b) < fmin(b,c) < fmin(a,c))
  76.     {
  77.         smallestFromABC = fmin(a, b);
  78.     }
  79.     else if (fmin(b,c) < fmin(a,b) < fmin(a,c))
  80.     {
  81.         smallestFromABC = fmin(b, c);
  82.     }
  83.     else if (fmin(a,c)< fmin(a,b) < fmin(b,c))
  84.     {
  85.         smallestFromABC = fmin(a, c);
  86.     }
  87.     bool task = (x == smallestFromABC);
  88.     cout << boolalpha << task << endl;
  89.     return 0;
  90. //z
  91.     double a, b, c, x;
  92.     cin >> a;
  93.     cin >> b;
  94.     cin >> c;
  95.     cin >> x;
  96.  
  97.    
  98.     bool task = (x != fmin(a, b) && x != fmin(b, c) && x != fmin(a, c));
  99.     cout << boolalpha << task << endl;
  100.     return 0;
  101. //i
  102.     bool x, y;
  103.     cin >> x;
  104.     cin >> y;
  105.     bool task = (x == false && y == false);
  106.     cout << boolalpha << task << endl;
  107.     return 0;
  108. //y
  109.     double a, b, c;
  110.     cin >> a;
  111.     cin >> b;
  112.     cin >> c;
  113.  
  114.  
  115.     bool task = (a > 0 || b > 0 || c > 0);
  116.     cout << boolalpha << task << endl;
  117.     return 0;
  118. //k
  119.     int n;
  120.     cout << "Enter a four-digit number: ";
  121.     cin >> n;
  122.     if (n > 999)
  123.     {
  124.         bool task = (n % 5 == 0);
  125.         cout << boolalpha << task << endl;
  126.     }
  127.     else
  128.     {
  129.         cout << "Your number is less than the minimum requirement!" << endl;
  130.     }
  131.  
  132.    
  133.     return 0;
  134. //l
  135.     int n;
  136.     cout << "Enter a four-digit number: ";
  137.     cin >> n;
  138.  
  139.     int rem, rem1;
  140.     vector<int> arr;
  141.  
  142.     if (n > 999)
  143.     {
  144.         for (int i = 1; i <= 4; i++)
  145.         {
  146.             rem1 = n % 10;
  147.             n = n / 10;
  148.            
  149.             arr.push_back(rem1);
  150.  
  151.         }
  152.         int a, b, c, d;
  153.            
  154.             a = arr[0];
  155.             b = arr[1];
  156.             c = arr[2];
  157.             d = arr[3];
  158.             if (a == b || a == c || a == d)
  159.             {
  160.                 cout << "True" << endl;
  161.             }
  162.             else if (b == c || b == d)
  163.             {
  164.                 cout << "True" << endl;
  165.             }
  166.             else if (c == d)
  167.             {
  168.                 cout << "True" << endl;
  169.             }
  170.             else
  171.             {
  172.                 cout << "False" << endl;
  173.             }
  174.         }
  175.         else
  176.         {
  177.             cout << "Your number is less than the minimum requirement!" << endl;
  178.         }
  179.  
  180.         return 0;
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement