# We'll iterate over all possible values of x and y and then compute the corresponding z to check if it's an integer and non-negative. count = 0 # Range for x (since 6x <= 300) for x in range(0, 301//6 + 1): # Range for y (since 4y <= 300 - 6x) for y in range(0, (300 - 6*x)//4 + 1): z = 300 - 6*x - 4*y if z >= 0: # z must be non-negative count += 1 print(count) #x = num of $2 #y = num of $1 #z = num of $0.25 #2x + y + 0.25z = 100 #8x + 4y + z = 400 #z = 400 - 8x - 4y #For z to be non-negitive: #400 - 8x - 4y > 0 #400 - 8x > 4y #4y < 400 - 8x #y < 100 - 2x #We can imply that 8x < 400 = x < 50 #x can be an interger between 0 and 50 #y can range from 0 to 100 - 2x #