Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = 10
- y = 25
- z = 15
- w = 40
- variantsQuantity = 0
- def calcRes(x, y, z, variantsQuantity):
- res = 0
- if w%x == 0:
- for el in range(int(w/x)):
- res+=x
- if w%res == 0 and res<=w:
- variantsQuantity += 1
- elif res>w:
- res = 0
- if w%y == 0:
- for el in range(int(w/y)):
- res+=y
- if w%res == 0 and res<=w:
- variantsQuantity += 1
- elif res>w:
- res = 0
- if w%z == 0:
- for el in range(int(w/z)):
- res+=z
- if w%res == 0 and res<=w:
- variantsQuantity += 1
- elif res>w:
- res = 0
- return variantsQuantity
- variantsQuantity = calcRes(x, y, z, variantsQuantity)
- print variantsQuantity
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement