py3求助
查看原帖
py3求助
404638
Gaojiangbo楼主2022/7/21 11:56

只能过三个测试点,其他全都超时

def f1(x):
  for i in range(2, x):
    if x % i == 0:
      break
  else:
    return 1
  return 0
def f2(a):
    b=str(a)[::-1]
    if b==str(a):
        return 1
    else: return 0
l=[]
m,n=map(int,input().split())
for i in range(m,n):
    if i%2!=0 and f1(i)==1 and f2(i)==1:
        l.append(i)
for i in l:
    print(i)





2022/7/21 11:56
加载中...