题解列表

筛选

1229基础解法(Python)

解题思路:直接调用Python的math库函数即可注意事项:Python3.9以上版本可以直接调用math.lcm()函数,其他版本只有math.gcd()函数参考代码:frommathimport*n,m=map(int,input().split())print(int(n*m/gcd(n,

接水问题 python

解题思路:先把学生里面前m个导入到数组中,然后通过k计算接水量,s即总人数减去除了开头接水人数的剩余人数,最后输出接水列表最大值注意事项:示例过大很容易超时所以直接设置列表长度为10000避免超出列表范围参考代码:n,m=map(int,input().split())stu=list(map(int

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

解题思路:暴力法注意事项:尽量使用较少的变量,尽可能使用内建函数参考代码:未优化前的代码:73%importsyssys.setrecursionlimit(200000)n=input()counter=0lst=[]lst_cmp=[iforiinrange(1,

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

解题思路:找到处理数据的合理方法,前缀和(说到底还是数学敏感)注意事项:注意sum()嵌套问题,尽量减少循环参考代码:暴力法:itertools的组合importitertoolsn=int(input())lst=list(map(int,

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

解题思路:简单题目简单写注意事项:减少循环次数最关键参考代码:a,b,n=map(int,input().split())cnt=0smr=a*5+b*2rec_week=divmod(n,smr)[0]left_day=n-rec_week*smrcnt+=rec_week*7ifleft_day>

python PEll数列解法

摘要:n=int(input())X=[]X1=[]for i in range(n):    X.append(int(input()))for i in range(n):    if X[i]==1:……

python 2024链表删除练习

摘要:n=int(input())num=list(map(int,input().split()))X=int(input())num1=[]for i in range(n):    if num[i]……