Advertisement
STANAANDREY

bac2k21 sb3 3

Mar 29th, 2022
2,119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     freopen("bac.txt", "r", stdin);
  6.     int x, a, b, ans1 = -1, ans2 = -1;
  7.     cin >> x >> a;
  8.     while (cin >> b) {
  9.         if (a % 1000 == x && b % 1000 == x) {
  10.             ans1 = a;
  11.             ans2 = b;
  12.         }
  13.         a = b;
  14.     }
  15.     if (ans1 == -1) {
  16.         cout << "nu exista" << endl;
  17.     } else {
  18.         cout << ans1 << ' ' << ans2 << endl;
  19.     }
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement