SMPDIV - Divisibility

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


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.


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


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

hide comments
krystianpecak: 2018-01-19 13:44:35

elo pozdro edit. LOL

Last edit: 2018-01-19 13:50:33
abuki123: 2018-01-10 08:26:55

Dajcie kod mordeczki

sm_programmer: 2017-06-30 11:33:28

@liuxueyang Thank you for the insight :D

rohit9934: 2017-06-19 20:07:34

should be moved to tutorials.

sabbirnoncoder: 2017-06-19 16:08:24

AC in 1st go

shivam_mnnit: 2017-05-05 20:14:05

i am getting a run time memory overflow problem . how do i solve it??

tasin_hoque: 2017-01-24 07:55:12

Thank you spoj for this easy problem!

priyance: 2016-10-31 20:36:53

Can anyone help me solve this problem as it is creating problem while reading the inputs and bcoz of that output is coming wrong?

peanuts3005: 2016-07-29 08:57:43

AC in 1st go

liuxueyang: 2016-07-16 14:47:26

AC in the 1st go in common lisp.
@aman25 Just loop from x to n by step x, if x mod y != 0, then print it. Hope it helps.

Added by:kuszi
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64