fork(5) 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. last_count = math.floor( ( summ - i * prices[0] - j * prices[1] ) / prices[2] ) + 1
  10. if ( i + j ) % 2 == 0 :
  11. counter += math.floor( last_count / 2 )
  12. else :
  13. counter += math.ceil( last_count / 2 )
  14.  
  15. return counter
  16.  
  17. print( bouquets(200,300,400,100000) )
  18.  
Success #stdin #stdout 0.09s 8736KB
stdin
Standard input is empty
stdout
3524556