Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- typedef long long ll;
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
- int a, b, n, m; cin >> a >> b >> n >> m;
- ll maa = a*(n+1) + n;
- ll mia = a*(n-1)+ n-1;
- ll mab = b*(m+1)+m;
- ll mib = b*(m-1) + b-1;
- if (maa < mib || mab < mia){
- cout << -1;
- return 0;
- }
- cout << max(mia, mib) << ' '<< min(maa, mab);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement