腾讯笔试--数据分析与技术研究

求一个大佬指点迷津,AC3题,最后两题自测全过了,但是提交之后都是0分
第四题 自测过了 但是超时了
import sys
n,k = map(lambda x: int(x), sys.stdin.readline().strip().split())
li st_ = []
count = 0
for i in range(n):
    t = list(map(lambda x: int(x), sys.stdin.readline().strip().split()))
    list_.append(t)
for i in range(n-1):
    for j in range(i+1,n,1):
        temp=list(map(lambda x :x[0]+x[1] ,zip(list_[i], list_[j])))
        if len(set(temp)) == 1:
            count += 1
print(count)
第五题 自测过了 但是提交之后是0分
import sys
T = int(sys.stdin.readline().strip())
output = []
for i in range(T):
    n = int(sys.stdin.readline().strip())
    dict1 = {}
    for j in range(n):
        temp_list = list(map(lambda x: int(x),sys.stdin.readline().strip().split()))
        m = temp_list[0]
        t = temp_list[1]
        dict1[m] = dict1.get(m, set([m]))
        dict1[m].add(t)
        dict1[t] = dict1.get(t, set([t]))
        dict1[t].add(m)
    max_len = 0
    for item in dict1.items():
        tempset = set()
        for temp in item[1]:
            tempset = tempset|set(dict1[temp])
        max_len = max(max_len,len(tempset))
    output.append(max_len)
for out in output:
    print(out)


#笔试题目##腾讯#
全部评论
第四题暴力可以30呀
点赞
送花
回复 分享
发布于 2020-04-26 22:12
大佬前三道可以发下代码吗
点赞
送花
回复 分享
发布于 2020-04-26 22:13
秋招专场
校招火热招聘中
官网直投
求分享第三题思路
点赞
送花
回复 分享
发布于 2020-04-26 22:13
第四题我也是暴力做的30%通过率,最后一题想暴力没时间了。
点赞
送花
回复 分享
发布于 2020-04-26 22:13
这都是暴力方法吧,肯定超时的
点赞
送花
回复 分享
发布于 2020-04-26 22:13
惊现巨佬
点赞
送花
回复 分享
发布于 2020-04-26 22:14
第三题,想得是全排列减去不会冲突的情况,只通过了10%,求思路分享
点赞
送花
回复 分享
发布于 2020-04-26 22:14
请问第三题怎么写啊代码可以发一下吗,我求了通项公式加快速幂,但是超时只对了30%
点赞
送花
回复 分享
发布于 2020-04-26 22:16
老哥我也想求一下代码和思路,第一次做这种笔试,现在迷茫的一笔。。
点赞
送花
回复 分享
发布于 2020-04-26 22:19
求大佬分享第三题代码~
点赞
送花
回复 分享
发布于 2020-04-26 22:20
楼主第三题怎么ac的呀
点赞
送花
回复 分享
发布于 2020-04-26 22:21
python 使用快速幂依然超时,求解答 def Pow(a, b):         if b == 0: return 1         if b < 0: return 1.0 / Pow(a, -b)         half = Pow(a, b // 2)         if b % 2 == 0:             return half * half         else:             return half * half * a if __name__ == "__main__":     m =  20000000     n =  300000000     count1 = Pow(m,n)     count2 = m * Pow(m-1,n-1)     count = count1 - count2     print(count % 100003)
点赞
送花
回复 分享
发布于 2020-04-26 22:27
第一题和第二题怎么做的呀
点赞
送花
回复 分享
发布于 2020-04-26 22:35
楼主问一下技术研究类和数据分析岗位,经历几次面试几次笔试啊?
点赞
送花
回复 分享
发布于 2020-08-20 10:02

相关推荐

点赞 9 评论
分享
牛客网
牛客企业服务