京东数据开发工程师笔试初版

#基因相似度算法

a=input()
b=input()
c=input()
N=list(map(int,a.split()))
N=N[0]
x=b.split(" ")
y=c.split(" ")
m=len(x)
n=len(y)
if (N<=1000 and m==n )and m==N:
c=[[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(1,N+1):
for j in range(1,N+1):
if x[i-1]==y[j-1]:
c[i][j]=c[i-1][j-1]+1
else:
c[i][j]=max(c[i-1][j],c[i][j-1])
M=c[N][N]
score=round(M/N,2)
if score>0.5:
print(score,"No")
else:
print(score,"Yes")

#查找一定范围内的回文素数
import itertools
a=input()
x,y=list(map(int,a.strip().split(" ")))
print(x,y)
num1=0
i1=[]
num1=0
out=[]
j=0
if x<y and x>=1 and y<=1e6:
for i in range(x,y+1):
n=list(str(i))
s=n.copy()
for k in range(len(n)):
q = False
s.remove(s[k])
s1="".join(itertools.chain(s))
s=n.copy()

if s1[::-1] == s1:
num = int(s1)
for j in range(2, num):
if num % j == 0:
break
q = True
else:
q = False

if q:
num1 += 1
out.append(i)
break
print(j)
print(num1)
print(out)


posted @ 2020-08-06 23:27  The-Chosen-One  阅读(603)  评论(0编辑  收藏  举报