My solutions for google foobar
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
563B

  1. """
  2. This one was really simple, compared to the XORFest I did before: you just
  3. get all the pairs that divide themselves with a larger number after, then do the
  4. same again.
  5. There's really nothing else to say, weird to see that as a level 3
  6. """
  7. def answer(l):
  8. triples = 0
  9. pairs = [0]*len(l)
  10. for i in range(1, len(l)-1):
  11. for j in range(i):
  12. if(l[i]%l[j]==0):
  13. pairs[i]+=1
  14. for i in range(2, len(l)):
  15. for j in range(1, i):
  16. if(l[i]%l[j]==0):
  17. triples += pairs[j]
  18. return triples