Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <set>
- #include <map>
- #include <algorithm>
- #include <string>
- #include <math.h>
- #include <vector>
- using namespace std;
- int main()
- {
- int X, Y, C;
- cin >> X >> Y >> C;
- if (X + Y < C)
- cout << "Impossible";
- else
- if (X + Y == C)
- cout << X << " " << Y;
- else
- if(X>=C||Y>=C)
- if (X >= C)
- {
- cout << C << " " << C - C;
- }
- else
- cout << C - C << " " << C;
- else
- {
- bool t = false;
- for (int i = X; i > -1; i--)
- {
- for (int j = Y; j > -1; j--)
- {
- if (j + i == C)
- {
- cout << i << " " << j;
- t = true;
- break;
- }
- }
- if (t == true)
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement