题解列表

筛选

做题记录2022.2.7(ac:100%)

摘要:解题思路:采用深度优先搜索和回溯                是8皇后问题的拓展和延伸注意事项:参考代码:def check(row, column, pattern):     global w……

Python解法,六行轻松搞定!

摘要:解题思路:①根据条件缩小第一个数的取值范围,因为最大为987,最小为123,故第一个数最小为123,最大为987的三分之一即329.对此范围的数进行遍历。②通过set()函数去重,然后判断集合元素个数……
优质题解

python-最优包含

摘要:解题思路:动态规划。①创建一个大小为(n+1)*(m+1)的二维数组,命名为dp,n和m分别为字符串s、t的长度。   其中dp[i][j]表示s中的前i个字符要想包含t的前j个字符最少需要修改几次。……

1259: 送分题素数

摘要:解题思路:注意事项:参考代码:def get(n):     s=0     for i  in range(2,n//2+1):         if n%i==0:          

1234: 检查一个数是否为质数

摘要:解题思路:注意事项:参考代码:n=int(input()) s=0 for i  in range(2,n//2+1):     if n%i==0:         print('N……

1232: 查找最大元素

摘要:解题思路:注意事项:参考代码:while True: try: a=input() s=max(a) str='' for i in a:     if i!=s:   ……

1229: 最小公倍数

摘要:解题思路:注意事项:参考代码:a,b=map(int,input().split()) def get(a,b):     if a%b==0:         return b      e……

python-单词分析

摘要:解题思路:注意事项:参考代码:A = list(input().strip())   B = set(A)   rst = dict()   for item in B:       rst.……

python-成绩分析

摘要:解题思路:注意事项:参考代码:n = int(input().strip()) A = [] for i in range(n):     A.append(int(input().strip(……