T3000

Untitled

Apr 4th, 2022
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.12 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, {0, 0});
  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.  
  77.     else if (t == 7)
  78.     {
  79.  
  80.         int i = 0;
  81.         z1.at(i).second = 1;
  82.         while (true)
  83.         {
  84.  
  85.             if (i >= n || i < 0)
  86.             {
  87.                 cout << "Out" << endl;
  88.                 return 0;
  89.             }
  90.             else if (i == n - 1)
  91.             {
  92.                 cout << "Done" << endl;
  93.                 return 0;
  94.             }
  95.             else
  96.             {
  97.  
  98.                 i = z1.at(i).first;
  99.             }
  100.  
  101.             if (z1.at(i).second == 1)
  102.             {
  103.                 cout << "Cyclic" << endl;
  104.                 return 0;
  105.             }
  106.             z1.at(i).second = 1;
  107.         }
  108.     }
  109.     return 0;
  110. }
Advertisement
Add Comment
Please, Sign In to add comment