当前位置: 首页 > 面试经验 >

0326晚腾讯算法笔试

优质
小牛编辑
159浏览
2023-03-28

0326晚腾讯算法笔试

a了前三道,第四题80%,第五题6%... (然鹅一面早已经g了,不知道会不会被捞)
T1:
n = int(input())
ans1 = list(map(str, input().split()))
ans2 = list(map(str, input().split()))
res = 0
for i in range(n):
flag = 0
if ans1[i] == ans2[i]:
res += 3
continue
else:
for s in ans1[i]:
if s not in ans2[i]:
flag = 1
break
if flag == 0:
res += 1
print(res)
T2:手动求积分
from math import sqrt, cos, sin
T = int(input())
for i in range(T):
a, b = map(float, input().split())
p = 2 * (- sqrt(b) * cos(sqrt(b)) + sqrt(a) * cos(sqrt(a)) + sin(sqrt(b)) - sin(sqrt(a))) / 5.68
# print(p)
if p > 0.5:
print(1)
else:
print(0)
T3:手动化简公式
from math import log
T = int(input())
for i in range(T):
k, t = map(float, input().split())
k = int(k)
diag = list(map(float, input().split()))
tr = sum(diag)
det = 1
for d in diag:
det *= d
KL = 0.5 * (- log(det) - k + tr)
if KL > t:
print(1)
else:
print(0)
#我的实习求职记录# #实习#
 类似资料: