。。那你还是用这个吧,我刚有个特殊判定没加上kinds = input()
m1,m2 = input().split()
splits = input().split()
m1 = int(m1)
m2 = int(m2)
time = set()
pri_m = set()
pri_tm = set()
for factor in range(2,m1+1):
if m1 % factor ==0:
ifadd = True
for f in pri_m:
if factor % f == 0:
ifadd = False
break
if ifadd:
tm = 0
while m1 % factor == 0:
m1 /= factor
tm += 1
pri_tm.add(tm)
pri_m.add(factor)
maxtm = max(pri_tm)*m2 if pri_tm else 0
for sp in splits:
sp = int(sp)
if len([sp for m in pri_m if sp % m == 0]) == len(pri_m):
pri_ts = set()
for t in pri_m:
ts = 0
while sp % t == 0:
sp /= t
ts += 1
pri_ts.add(ts)
maxts= max(pri_ts) if pri_ts else 1
if maxtm % maxts == 0:
time.add(maxtm // maxts)
else:
for t in range(2,maxtm+1):
if maxts *t > maxtm:
time.add(t)
break
else:
time.add(-1)
time.discard(-1)
if time:
print(min(time))
else:
print(-1)
|