Advertisement
ivnikkk

Untitled

Mar 9th, 2022
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #pragma GCC optimize("Ofast")
  2. #pragma GCC optimize("unroll-loops")
  3. #pragma GCC target("avx2")
  4. #define _CRT_SECURE_NO_WARNINGS
  5. #define debug(l) cerr<<" smotri huinyi : "<<#l<<' '<<l<<'\n';
  6. #include "bits/stdc++.h"
  7. //#include "geometry.h"
  8. //#include "data_structure.h"
  9. using namespace std;
  10. using namespace chrono;
  11. #define all(cnt) cnt.begin(), cnt.end()
  12. #define allr(cnt) cnt.rbegin(), cnt.rend()
  13. #define sqrt(l) sqrtl(l)
  14. mt19937 rnd(std::chrono::high_resolution_clock::now().time_since_epoch().count());
  15. typedef long long ll;
  16. typedef long double ld;
  17. signed main() {
  18. #ifdef _DEBUG
  19.     freopen("input.txt", "r", stdin);
  20.     freopen("output.txt", "w", stdout);
  21. #endif
  22.     ios_base::sync_with_stdio(false);
  23.     cin.tie(nullptr);
  24.     ll a, b, c, d;
  25.     cin >> a >> b >> c >> d;
  26.     vector<ll> ans;
  27.     for (ll i = 1e4; i < 1e5; i++) {
  28.         if (i % a == b && i % c == d) {
  29.             ans.push_back(i);
  30.         }
  31.     }
  32.     if (ans.empty()) {
  33.         cout << -1 << '\n';
  34.     }
  35.     else {
  36.         for (ll& i : ans) {
  37.             cout << i << ' ';
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement