Open juicewdc opened 1 week ago
использование f-строк
#маска 23?456?89 for c1 in 0123456789: for c2 in 0123456789: a=int(f'23{c1}456{c2}89' if a%17==0: print(a,a//17)
cnt=0 a=[] from itertools import product from fnmatch import fnmatch for x1,x2,x3,x4 in product('0123456789',repeat=4): c=f'4{x1}8{x2}15{x3}16{x4}23' if fnmatch(c,'4?8?15?16?23'): if int(c)%123==42: cnt+=1 a.append(int(c)) print(cnt,max(a))