fork(8) download
  1. # your code goes here
  2. import math
  3.  
  4. def bouquets(narcissus_price, tulip_price, rose_price, summ):
  5. prices = sorted( [ narcissus_price, tulip_price, rose_price ], reverse = True )
  6. counter = 0
  7. for i in range( math.floor( summ / prices[0] ) + 1 ):
  8. for j in range( math.floor( ( summ - i * prices[0] ) / prices[1] ) + 1):
  9. counter += math.floor( ( summ - i * prices[0] - j * prices[1] ) / prices[2] ) + 1
  10.  
  11. return counter
  12.  
  13. print( bouquets(1,1,1,2) )
  14.  
Success #stdin #stdout 0.02s 8696KB
stdin
Standard input is empty
stdout
10