Advertisement
STANAANDREY

sim 2021 III 3

May 10th, 2021 (edited)
1,054
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream fin("bac.in");
  5. bool isInFile[100];
  6. int out[2];
  7.  
  8. int main() {
  9.     for (int x; fin >> x;) {
  10.         if (x < 100) {
  11.             isInFile[x] = true;
  12.         }
  13.     }
  14.     int written = 0;
  15.     for (int a = 9; a; a--) {
  16.         for (int b = a - 1; b; b--) {
  17.             int nr = a * 10 + b;
  18.             if (!isInFile[nr]) {
  19.                 out[written] = nr;
  20.                 written++;
  21.             }
  22.             if (written == 2) {
  23.                 cout << out[0] << ' ' << out[1] << endl;
  24.                 return 0;
  25.             }
  26.         }
  27.     }
  28.     cout << "nu exista" << endl;
  29.     return 0;
  30. }
  31.  
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement