JustPaste.it

# 1. Divisors

a, b = input("a b: ").split()
a = int(a)
b = int(b)
while not (0 < a) or not (a < b):
    a, b = input("a b: ").split()
    a = int(a)
    b = int(b)

 

d1, d2 = input("Divisors: ").split()
d1 = int(d1)
d2 = int(d2)
while not (0 < d1) or not (d1 <= b) or not (0 < d2) or not (d2 <= b):
    d1, d2 = input("Divisors: ").split()
    d1 = int(d1)
    d2 = int(d2)

 

print("M", d1, d2)

 

for i in range(a, b):
    if (i % d1):
        first = 0;
    else:
        first = 1;
    if (i % d2):
        second = 0;
    else:
        second = 1;
    print(i, first, second)