File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
CompetitiveProgramming/SPOJ Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ # Print all integers ai such that ai is divisible by x and not divisible by y, where 1 < ai < n < 100000.
2+ #
3+ # Input
4+ #
5+ # First, you are given t (t<100) - the number of test cases. In each of the following t lines, 3 integers: n x y.
6+ #
7+ # You might assume also that x < n and x is not divisible by y.
8+ #
9+ # Output
10+ #
11+ # In each of the following t lines, numbers requested in the problem description in the separated by a single space in
12+ # ascending order.
13+ #
14+ # Example
15+ #
16+ # Input:
17+ # 2
18+ # 7 2 4
19+ # 35 5 12
20+ # Output:
21+ # 2 6
22+ # 5 10 15 20 25 30
23+
24+ testCases = int (input ())
25+ for _ in range (testCases ):
26+ n , x , y = map (int , input ().split ())
27+ for i in range (n ):
28+ if i % x == 0 and i % y != 0 :
29+ print (i , end = ' ' )
30+ print ()
You can’t perform that action at this time.
0 commit comments