4.18腾讯云智笔试
题目简单 笔试头一次ak 期待面试
接好运
题目分享:20道选择题,两道算法题,一道SQL题
##Q1 import collections s=input() ans=0 temp='ABCDEFGHIGKLMNOPQRSTUVWXYZ' cnt=collections.defaultdict(int) for ss in s: cnt[ss]+=ord(ss) for tt in temp: if cnt[tt]==0: ans += ord(tt) print(ans) ##Q3 from math import inf #s = input() s = 'acmmer' def compare(ss: str) -> int: ex = 'AcMer' ansss = 0 for i in range(5): if ss[i] == ex[i]: ansss += 0 elif abs(ord(ss[i]) - ord(ex[i])) == 32: ansss += 5 elif 65 <= ord(ss[i]) <= 90 and 65 <= ord(ex[i]) <= 90: ansss += 5 elif 97 <= ord(ss[i]) <= 122 and 97 <= ord(ex[i]) <= 122: ansss += 5 else: ansss += 10 return ansss ans = inf n = len(s) left = 0 tmp = 0 for right in range(4, n): if right - left + 1 != 5: break ans = min(ans, compare(s[left:right + 1])) left += 1 print(ans)
SQL
SELECT c.tag AS tag, ROUND(SUM(TIMESTAMPDIFF(MINUTE,p.start_time,p.end_time)),3) AS time_len, ROUND(AVG(score),3) AS avg_score FROM course_info_tb c INNER JOIN play_record_tb p ON c.cid=p.cid GROUP BY c.tag ORDER BY c.cid;#笔试##腾讯云智研发2025实习生招聘#