Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- int main()
- {
- ll n, t;
- cin >> n >> t;
- vector<pair<ll, ll>> z1(n);
- for (int i = 0; i < n; i++)
- {
- cin >> z1.at(i).first;
- }
- if (t == 1)
- {
- cout << 7 << endl;
- }
- else if (t == 2)
- {
- if (z1.at(0).first > z1.at(1).first)
- {
- cout << "Bigger" << endl;
- }
- else if (z1.at(0).first == z1.at(1).first)
- {
- cout << "Equal" << endl;
- }
- else
- {
- cout << "Smaller" << endl;
- }
- }
- else if (t == 3)
- {
- cout << (z1.at(0).first + z1.at(1).first + z1.at(2).first) / 3 << endl;
- }
- else if (t == 4)
- {
- ll sum = 0;
- for (int i = 0; i < n; i++)
- {
- sum += z1.at(i).first;
- }
- cout << sum << endl;
- }
- else if (t == 5)
- {
- ll sum = 0;
- for (int i = 0; i < n; i++)
- {
- if (z1.at(i).first % 2 == 0)
- {
- sum += z1.at(i).first;
- }
- }
- cout << sum << endl;
- }
- else if (t == 6)
- {
- vector<ll> z2;
- for (int i = 0; i < n; i++)
- {
- z2.push_back(z1.at(i).first % 26);
- }
- for (int i = 0; i < n; i++)
- {
- cout << char(z2.at(i) + 97);
- }
- cout << endl;
- }
- else if (t == 7)
- {
- int i = 0;
- while (true)
- {
- z1.at(i).second = 1;
- if (i >= n)
- {
- cout << "Out" << endl;
- return 0;
- }
- else if (i == n - 1)
- {
- cout << "Done" << endl;
- return 0;
- }
- else
- {
- i = z1.at(i).first;
- }
- if (z1.at(i).second == 1)
- {
- cout << "Cyclic" << endl;
- return 0;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment