Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <queue>
- #include <algorithm>
- #include <string>
- #include <stack>
- #include <set>
- #include <map>
- #define pii pair <int, int>
- #define pb(x) push_back(x)
- using namespace std;
- using ll = long long;
- using ld = long double;
- using db = double;
- void cv(vector <int> &v) {
- for (auto x : v) cout << x << ' ';
- cout << "\n";
- }
- void cvl(vector <ll> &v) {
- for (auto x : v) cout << x << ' ';
- cout << "\n";
- }
- void cvv(vector <vector <int> > &v) {
- for (auto x : v) cv(x);
- cout << "\n";
- }
- void cvb(vector <bool> v) {
- for (bool x : v) cout << x << ' ';
- cout << "\n";
- }
- void cvs(vector <string> v) {
- for (auto a : v) {
- cout << a << "\n";
- }
- }
- void cvp(vector <pii> a) {
- for (auto p : a) {
- cout << p.first << ' ' << p.second << "\n";
- }
- cout << "\n";
- }
- int main() {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- vector <vector <int> > KOZ = {
- {
- 0, 0, 0
- },
- {
- 1, 1, 2
- },
- {
- 2, 2, 4
- },
- {
- 3, 3, 6
- },
- {
- 4, 4, 8
- },
- {
- 5, 6, 0
- },
- {
- 6, 7, 2
- },
- {
- 7, 8, 4
- },
- {
- 8, 9, 6
- }
- };
- int K, O, Z;
- vector <int> ans(10);
- vector < vector <pair <int, string> > > get;
- for (auto vec: KOZ) {
- K = vec[0];
- O = vec[1];
- Z = vec[2];
- for (int PH = 1; PH <= 9; ++PH) {
- for (int H = 1; H <= O; ++H) {
- int P = O - H;
- int M = (101 * PH + 10 * H) / (10 * PH + O);
- if (M * (10 * PH + O) != 101 * PH + 10 * H) {
- continue;
- }
- int A = (M * K - P) / 10;
- if (M * K - P < 0) {
- continue;
- }
- if (10 * A != M * K - P) {
- continue;
- }
- int I = (10 * PH + 11 * K + P) / 100;
- if (I * 100 != 10 * PH + 11 * K + P) {
- continue;
- }
- vector <pair <int, string> > see(10);
- ans[0] = PH;
- see[0] = {PH, "PH"};
- ans[1] = O;
- see[1] = {O, "O"};
- ans[2] = M;
- see[2] = {M, "M"};
- ans[3] = H;
- see[3] = {H, "H"};
- ans[4] = K;
- see[4] = {K, "K"};
- ans[5] = Z;
- see[5] = {Z, "Z"};
- ans[6] = I;
- see[6] = {I, "I"};
- ans[7] = 0;
- see[7] = {0, "SH"};
- ans[8] = A;
- see[8] = {A, "A"};
- ans[9] = P;
- see[9] = {P, "P"};
- cv(ans);
- sort(see.begin(), see.end());
- for (auto p: see) {
- cout << p.second << ' ';
- }
- cout << "\n";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement