Advertisement
Korotkodul

N2_отбор

Nov 11th, 2022 (edited)
894
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.18 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <queue>
  5. #include <algorithm>
  6. #include <string>
  7. #include <stack>
  8. #include <set>
  9. #include <map>
  10. #define pii pair <int, int>
  11. #define pb(x) push_back(x)
  12. using namespace std;
  13. using ll = long long;
  14. using ld = long double;
  15. using db = double;
  16. void cv(vector <int> &v) {
  17.     for (auto x : v) cout << x << ' ';
  18.     cout << "\n";
  19. }
  20.  
  21. void cvl(vector <ll> &v) {
  22.     for (auto x : v) cout << x << ' ';
  23.     cout << "\n";
  24. }
  25.  
  26.  
  27. void cvv(vector <vector <int> > &v) {
  28.     for (auto x : v) cv(x);
  29.     cout << "\n";
  30. }
  31.  
  32. void cvb(vector <bool> v) {
  33.     for (bool x : v) cout << x << ' ';
  34.     cout << "\n";
  35. }
  36.  
  37. void cvs(vector <string>  v) {
  38.     for (auto a : v) {
  39.         cout << a << "\n";
  40.     }
  41. }
  42.  
  43. void cvp(vector <pii> a) {
  44.     for (auto p : a) {
  45.         cout << p.first << ' ' << p.second << "\n";
  46.     }
  47.     cout << "\n";
  48. }
  49.  
  50.  
  51.  
  52. int main() {
  53.     ios::sync_with_stdio(0);
  54.     cin.tie(0);
  55.     cout.tie(0);
  56.     vector <vector <int> > KOZ = {
  57.         {
  58.             0, 0, 0
  59.         },
  60.         {
  61.             1, 1, 2
  62.         },
  63.         {
  64.             2, 2, 4
  65.         },
  66.         {
  67.             3, 3, 6
  68.         },
  69.         {
  70.             4, 4, 8
  71.         },
  72.         {
  73.             5, 6, 0
  74.         },
  75.         {
  76.             6, 7, 2
  77.         },
  78.         {
  79.             7, 8, 4
  80.         },
  81.         {
  82.             8, 9, 6
  83.         }
  84.     };
  85.     int K, O, Z;
  86.     vector <int> ans(10);
  87.     vector < vector <pair <int, string> > > get;
  88.     for (auto vec: KOZ) {
  89.         K = vec[0];
  90.         O = vec[1];
  91.         Z = vec[2];
  92.         for (int PH = 1; PH <= 9; ++PH) {
  93.             for (int H = 1; H <= O; ++H) {
  94.                 int P = O - H;
  95.                 int M = (101 * PH + 10 * H) / (10 * PH + O);
  96.                 if (M * (10 * PH + O) != 101 * PH + 10 * H) {
  97.                     continue;
  98.                 }
  99.                 int A = (M * K - P) / 10;
  100.                 if (M * K - P < 0) {
  101.                     continue;
  102.                 }
  103.                 if (10 * A != M * K - P) {
  104.                     continue;
  105.                 }
  106.                 int I = (10 * PH + 11 * K + P) / 100;
  107.                 if (I * 100 != 10 * PH + 11 * K + P) {
  108.                     continue;
  109.                 }
  110.                 vector <pair <int, string> > see(10);
  111.                 ans[0] = PH;
  112.                 see[0] = {PH, "PH"};
  113.                 ans[1] = O;
  114.                 see[1] = {O, "O"};
  115.                 ans[2] = M;
  116.                 see[2] = {M, "M"};
  117.                 ans[3] = H;
  118.                 see[3] = {H, "H"};
  119.                 ans[4] = K;
  120.                 see[4] = {K, "K"};
  121.                 ans[5] = Z;
  122.                 see[5] = {Z, "Z"};
  123.                 ans[6] = I;
  124.                 see[6] = {I, "I"};
  125.                 ans[7] = 0;
  126.                 see[7] = {0, "SH"};
  127.                 ans[8] = A;
  128.                 see[8] = {A, "A"};
  129.                 ans[9] = P;
  130.                 see[9] = {P, "P"};
  131.                 cv(ans);
  132.                 sort(see.begin(), see.end());
  133.                 for (auto p: see) {
  134.                     cout << p.second << ' ';
  135.                 }
  136.                 cout << "\n";
  137.             }
  138.         }
  139.     }
  140.  
  141. }
  142.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement