T3000

Untitled

Apr 4th, 2022
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.07 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. using ll = long long;
  5.  
  6. int main()
  7. {
  8.     ll n, t;
  9.     cin >> n >> t;
  10.     vector<pair<ll, ll>> z1(n);
  11.     for (int i = 0; i < n; i++)
  12.     {
  13.  
  14.         cin >> z1.at(i).first;
  15.     }
  16.     if (t == 1)
  17.     {
  18.         cout << 7 << endl;
  19.     }
  20.     else if (t == 2)
  21.     {
  22.         if (z1.at(0).first > z1.at(1).first)
  23.         {
  24.             cout << "Bigger" << endl;
  25.         }
  26.         else if (z1.at(0).first == z1.at(1).first)
  27.         {
  28.             cout << "Equal" << endl;
  29.         }
  30.         else
  31.         {
  32.             cout << "Smaller" << endl;
  33.         }
  34.     }
  35.     else if (t == 3)
  36.     {
  37.         cout << (z1.at(0).first + z1.at(1).first + z1.at(2).first) / 3 << endl;
  38.     }
  39.     else if (t == 4)
  40.     {
  41.         ll sum = 0;
  42.         for (int i = 0; i < n; i++)
  43.         {
  44.  
  45.             sum += z1.at(i).first;
  46.         }
  47.         cout << sum << endl;
  48.     }
  49.     else if (t == 5)
  50.     {
  51.         ll sum = 0;
  52.         for (int i = 0; i < n; i++)
  53.         {
  54.             if (z1.at(i).first % 2 == 0)
  55.             {
  56.                 sum += z1.at(i).first;
  57.             }
  58.         }
  59.         cout << sum << endl;
  60.     }
  61.     else if (t == 6)
  62.     {
  63.         vector<ll> z2;
  64.         for (int i = 0; i < n; i++)
  65.         {
  66.  
  67.             z2.push_back(z1.at(i).first % 26);
  68.         }
  69.         for (int i = 0; i < n; i++)
  70.         {
  71.  
  72.             cout << char(z2.at(i) + 97);
  73.         }
  74.         cout << endl;
  75.     }
  76.     else if (t == 7)
  77.     {
  78.  
  79.         int i = 0;
  80.         while (true)
  81.         {
  82.             z1.at(i).second = 1;
  83.  
  84.             if (i >= n)
  85.             {
  86.                 cout << "Out" << endl;
  87.                 return 0;
  88.             }
  89.             else if (i == n - 1)
  90.             {
  91.                 cout << "Done" << endl;
  92.                 return 0;
  93.             }
  94.  
  95.             else
  96.             {
  97.  
  98.                 i = z1.at(i).first;
  99.             }
  100.             if (z1.at(i).second == 1)
  101.             {
  102.                 cout << "Cyclic" << endl;
  103.                 return 0;
  104.             }
  105.         }
  106.     }
  107.     return 0;
  108. }
Advertisement
Add Comment
Please, Sign In to add comment