Segment remainders

Given a segment [l; r], your task is to find all the numbers that when divided by d produce a remainder c.
The input of the program contains 4 numbers l, r, c, and d.
The program should print all the numbers satisfying the condition separated by a space.
Input
Output
2 5 0 2
2 4
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue