juicewdc / infa

0 stars 0 forks source link

25 zadanie maski #4

Open juicewdc opened 1 week ago

juicewdc commented 1 week ago
#` from fnmatch import *

# for x in range(17,10**9+1,17):
#     s=str(x)
#     if s[:5]=='12345' and s[:-3]=='6' and s[:-1]=='8':
#     #if fnmatch(str(x),"12345?6?8"):
#         if x%17==0:
#             print(x,x//17)

# 4603 3692 3693 4711
# from fnmatch import *
# for x in range(10**8+1):
#     if fnmatch(str(x),'1234*7'):
#         if x%141:
#             print(x,x//141)

# from fnmatch import *
# for x in range(10**9+1):
#     if fnmatch(str(x),'123*567?'):
#         if x%169:
#             print(x,x//169)

# from fnmatch import *
# for x in range(51,10**6+1,51):
#     if fnmatch(str(x),'12*45*'):
#         print(x,x//51)

# from fnmatch import fnmatch
# for x in range(2023,10**10+1,2023):
#     if fnmatch(str(x),'1?2139*4'):
#         print(x,x//2023)

#4899
# from fnmatch import fnmatch
# def f(x):
#     a=set()
#     for i in range(1,int(x**0,5)+1):
#         if x % i == 0:
#             if i%2==0:
#                 a.add(i)
#             if (x//i)%2==0:
#                 a.add(x//i)
#     if len(a)>=4:
#         return sum(a)
#     else:return 0
# for i in range(65001,10**6):
#     if fnmatch(str(i),'6*97*5?'):
#         print(i,f(i))
# def IsPrime(n):
#     d=2
#     while n%d!=0:
#         d+=1
#     return n==d
#
# a=[]
# for i in range(478392,502439):
#     if IsPrime(i):
#         a.append(i)
#         print(i)
#
# 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))
juicewdc commented 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)

juicewdc commented 6 days ago

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))