First of all, if X+Y is less than the sum than there is no answer, in all other cases we can find an answer pair for sure. Here is how we will find it. We will take the difference of the X+Y and the sum. Assuming that our answer pair is X and Y until the difference is 0. We take the difference of X+Y and sum and we subtract it from X, until either X becomes 0 or the difference. The rest difference, we will subtract from Y and the resulted X and Y will be out answer.
No comments:
Post a Comment