GO Solution For UVa 10493 - Cats, with or without Hats. In this post we will see how we can solve this challenge in GoLang for UVa Online Judge.

Problem Description

A cat wears a hat if and only if it has N cats in its hat. There is exactly one cat that is not inside any other cat’s hat. If there are M cats without hats, how many cats are there?

Input Input consists of several test cases. For each case, there would be two integers, N and M , where 1 ≤ N < 1000


You can find the full details of the problem Cats, with or without Hats at UVa Online Judge

Sample Input

2 5
3 4
3 3
0 0

Sample Output

2 5 9
3 4 Impossible
3 3 4

Solution: Please check the main.go snippet for the solution.

Solution originally posted at: Github by @codingsince1985