Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int a, b, c, n;
- cin >> a >> b >> c >> n;
- int n3 = c;
- for (int n1 = 0; n1 <= n; n1++)
- for (int n2 = 0; n2 <= n; n2++)
- for (int n4 = 1; n4 <= n; n4++)
- if (n1 + n3 == a && n2 + n3 == b && n1 + n2 + n3 + n4 == n) {
- cout << n4;
- return 0;
- }
- cout << -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement