题解列表
自定义函数求一元二次方程
解题思路:注意事项:1、当判别式小于0时,会出现虚数;2、最终结果要保留三位小数;3、两个解是以空格分隔的。参考代码:a,b,c=map(int,input().split())d=b**2-4*a*cifd>0:x1=(b+d**(1/2))/(-2*a)x2=(b-d**(1/2))/(-2*a)
蓝桥杯专题系列-1431(Python)
解题思路:模拟题,了解运作过程即可注意事项:使用lst.copy()静态改写列表,不要动态改写参考代码:n=int(input())lst=list(reversed(list((map(int,input().split())))))cnt=0defconsider(lst_):globalcnts
递归问题,类似于斐波那契问题
摘要:解题思路:小母牛四年生一头小母牛,所以下一个数会等于其前面一个数和其前面第三个数之和注意事项:当n=0时,要退出,不能让其输出结果参考代码:while True: try: n =……
桥杯2014年第五届真题-排列序数用数组或字典会超内存
摘要:解题思路:import itertoolsa=[]count=0n=input()x=sorted(n)for i in itertools.permutations(x): s="".join……
最长公共子序列lcs
解题思路:注意事项:参考代码:s1,s2=map(str,input().split())dp=[[0]*(len(s2)+1)foriinrange(len(s1)+1)]foriinrange(len(s1)):dp[i][0]=0forjinrange(len(s2)):dp[0][j]=0fo
蓝桥杯2018年第九届真题-航班时间-暴力解法
摘要:解题思路:注意事项:参考代码:import ren=int(input())ls=[]while n!=0: a=list(map(str,input().split())) b=list……
2916: 谁考了第k名(python)
摘要:解题思路:注意事项:参考代码:def KEY(x):
return float(x[1])
n,k = map(int,input().strip().split())
nu……