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