Submit | All submissions | Best solutions | Back to list |
THROWINGBALLS - Throwing Balls |
Your friends invented a new competition: Throwing Balls. The goal is simple, just throw a ball in a way that it falls into a hole N meters ahead.
When the ball is thrown, let's say that at an integer speed V, it stays in the air for V meters and then touches the ground. It repeats this process V times. After it touches the ground V times, it changes its speed to V-1, and the previous process repeats, until the speed is equal to 0.
For example, if the ball is thrown at a speed equal to 3, it will touch the ground at the following points: 3, 6, 9, 11, 13, 14; as it can be seen in the picture below.
You can throw a ball at an integer speed less than or equal to V. Given the distance of the hole, say if it's possible for you to throw the ball and that it falls exactly into the hole.
Input
There will be several test cases. Each test case contains two integers, N and V (1 ≤ N ≤ 1000, 1 ≤ V ≤ 30), representing the distance of the hole, and the maximum speed that you can throw the ball.
The last test case is indicated when N = V = 0, which should not be processed.
Output
For each teste case, print one line containing the word “possivel” (without the quotation marks), if it is possible to throw the ball at an integer speed less than or equal to V, in a way that it falls into the hole, or “impossivel” otherwise.
Example 1
Input: 14 3 13 3 12 3 5 3 30 4 0 0 Output: possivel possivel impossivel possivel possivel
Added by: | Coach UTN FRSF |
Date: | 2015-09-12 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |