Public submissions
Source code of every submission to this problem in this contest will be visible for everyone since 2013-08-26 11:14:31.

SMPDIV - Divisibility

Print all integers ai such that ai is divisible by x and not divisible by y, where 1 < ai < n < 100000.

Input

First, you are given t (t < 100) - the number of test cases. In each of the following t lines, 3 integers: n x y.

You might assume also that x < n and x is not divisible by y.

Output

In each of the following t lines, numbers requested in the problem description in the separated by a single space in ascending order.

Example

Input:
2
7 2 4
35 5 12
Output:
2 6
5 10 15 20 25 30

Added by:kuszi
Date:2013-08-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Public source code since: 2013-08-26 11:14:31

hide comments
2014-06-25 20:24:06 Jitendra Mandi
anyone whats the logic of t lines please...
2014-01-26 11:04:11 Unknown
i am getting the wrong answer here while the code is running on my console. please help
2014-01-19 16:19:57 kuszi
@Stefan Majoor: Thank you for your comment, fixed.
2014-01-18 17:47:05 Stefan Majoor
Some more restrictions for the input:
n > x and x is not divisible by y
2014-01-09 05:43:03 Abhijit Raj
Arrays aren't required to solve this problem. You can use simple increment scratching the ones you don't require.
2013-12-30 19:58:08 Sandhya Saravanan
Is there a simpler way to solve the problem without using arrays where all the input is given together and all output printed together after that? Please suggest!
@Snehasish Nothing will be printed then. Leave it blank and go to the next line.

Last edit: 2013-12-31 08:52:37
2013-12-28 08:37:18 Snehasish Karmakar
What to print if for a particular combination of n, x and y, there is no such number which is divisible by x and not divisible by y ??
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.