fork(2) download
  1. from itertools import permutations as perm
  2. from datetime import date, timedelta
  3.  
  4. origDate = date(2018,1,1)
  5. numbers = {str(x) for x in range(10)}
  6. stepA, R = set(), set()
  7.  
  8. for x in range(365):
  9. pDate = origDate + timedelta(days=x)
  10. if len({x for x in "{:02d}{:02d}".format(pDate.month, pDate.day)}) == 4:
  11. stepA.add("{:02d}{:02d}".format(pDate.month, pDate.day))
  12.  
  13. for x in stepA:
  14. pNum = perm(numbers - {y for y in x})
  15. q = ((int(y[0]+y[1]),int(y[2]+y[3]),int(y[4]+y[5])) for y in pNum)
  16. r = (z for z in q if 0<=z[0]<=23 and 0<=z[1]<=59 and 0<=z[2]<=59)
  17. if r: R = R | {(x,z[0],z[1],z[2]) for z in r}
  18.  
  19. print(len(R))
  20. for x in sorted(list(R)):
  21. print("".join(map(str,x)))
  22. break
Success #stdin #stdout 0.11s 28080KB
stdin
Standard input is empty
stdout
768
0326174859