Advertisement
hopingsteam

Untitled

Apr 11th, 2020
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include    <iostream>
  2. #include    <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream fin("bac.in");
  7.  
  8. int main()
  9. {
  10.     int s1, s2;
  11.     fin >> s1 >> s2;
  12.    
  13.     int V[5];
  14.     for(int i = 0; i <= s1; i++)
  15.     {
  16.         if(i == 0)
  17.             continue;
  18.         V[0] = i;
  19.         V[1] = s1-i;
  20.         if(V[0] > 9 || V[1] > 9)
  21.             continue;
  22.         for(int j = 0; j <= 9; j++)
  23.         {
  24.             V[2] = j;
  25.             for(int k = 0; k <= s2; k++)
  26.             {
  27.                 V[3] = k;
  28.                 V[4] = s2-k;
  29.                 if(V[3] > 9 || V[4] > 9)
  30.                     continue;
  31.                 cout << V[0] << V[1] << V[2] << V[3] << V[4] << "\n";
  32.             }
  33.         }
  34.     }
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement