题解列表

筛选

弟弟的作业——判断算式是否正确

摘要:解题思路:参考了其他作者的代码,利用‘==’,判断算式是否成立注意事项:参考代码:def check(L):    if '?' in L:        return 0    el……

巧用字典get方法

摘要:解题思路:注意事项:参考代码:s=input()t=dict()c=set()a=''for i in range(len(s)):    t[s[i]]=t.get(s[i],0)+……

Python 深度优先算法(DFS)

摘要:解题思路:注意事项:参考代码:n,r = map(int,input().strip().split()) nums = [i for i in range(1,n+1)] result = []……

蓝桥杯专题系列-1097(Python)

解题思路:总体思路是找规律注意事项:做好数据类型的转换处理即可参考代码:n=int(input())dp=[[0foriinrange(n)]foriinrange(n)]a=0b=0cnt=1foriinrange(1,n+1):forjinrange(i):dp[a][b]=cntifa==0:a

求最小公倍数-python 使用Counter计数

解题思路:求出每个数的所有质因数,对于每个数分别用Counter类记录每个质因数的个数,最后将三个Counter取并集,求得最小公倍数注意事项:Counter的具体用法可以参考https://zhuanlan.zhihu.com/p/355601478参考代码:fromcollectionsimpor