Advertisement
hopingsteam

Untitled

Apr 22nd, 2020
618
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. #include    <iostream>
  2. #include    <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ofstream fout("bac.out");
  7.  
  8. int main()
  9. {
  10.     unsigned int p1, p2;
  11.     cin >> p1 >> p2;
  12.     int nr = 0;
  13.  
  14.     int v[7];
  15.     for(int i = 9; i > 0; i--)
  16.     {  
  17.         if(p1 % i == 0)
  18.         {
  19.             int c1 = i;
  20.             int c2 = p1 / i;
  21.             if(c2 < 10)
  22.             {
  23.                 v[0] = c1;
  24.                 v[1] = c2;
  25.                 for(int k = 9; k >= 0; k--) {
  26.                     for (int j = 9; j > 0; j--) {
  27.                         if (p2 % j == 0) {
  28.                             int c1 = j;
  29.                             int c2 = p2 / j;
  30.                             if (c2 < 10) {
  31.                                 v[2] = k;
  32.                                 v[3] = k;
  33.                                 v[4] = k;
  34.                                 v[5] = c1;
  35.                                 v[6] = c2;
  36.                                 cout << v[0] << v[1] << v[2] << v[3] << v[4] << v[5] << v[6] << "\n";
  37.                             }
  38.                         }
  39.                     }
  40.                 }
  41.             }
  42.         }
  43.     }
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement