fork download
  1. def bouquets(narcissus_price, tulip_price, rose_price, summ):
  2. n=int(summ//narcissus_price)
  3. k=int(summ//tulip_price)
  4. p=int(summ//rose_price)
  5. count=0
  6. for i1 in range(0,n+1):
  7. for i2 in range(0,k+1):
  8. for i3 in range(0, p+1):
  9. if (i1+i2+i3)%2 != 0:
  10. if i1*narcissus_price+i2*tulip_price+i3*rose_price<=summ:
  11. count+=1
  12. else:
  13. break
  14. return count
  15.  
  16. print( bouquets(200,300,400,100000) )
Success #stdin #stdout 4.6s 9984KB
stdin
Standard input is empty
stdout
3524556