编写题解:分解质因数【Python】 摘要:解题思路:首先自定义函数判断是否为质数;分解质因数时:先找最小质因数flag,然后递归找n//flag的最小质因数参考代码:# 自定义函数来判断是否是质数 def isPrime(n): …… 题解列表 2022年12月07日 0 点赞 0 评论 578 浏览 评分:9.9
约瑟夫环重新写一遍 摘要:解题思路:注意事项:最后li2=[3,6,1,5,2,8,4,7]参考代码:n,m=map(int,input().split())li=[]li2=[]for i in range(1,n+1): …… 题解列表 2022年12月06日 0 点赞 0 评论 511 浏览 评分:0.0
菜鸟首次尝试(python)超简单解法 解题思路:先写个输入,再用for循环来表示饥行,count_hang来记录行数,最后打印出来就行注意事项:参考代码:n=int(input())count_hang=0foriinrange(n):count_hang+=1ls=(input().split())a=max(ls)t=ab=tifa> 题解列表 2022年12月06日 0 点赞 0 评论 635 浏览 评分:9.9
题解: 蓝桥杯算法训练VIP-提货单【Python】 摘要:注意事项:最终格式化输出,小数点保留6位。参考代码:N = int(input()) inf = [] for i in range(N): inf.append(list(input(…… 题解列表 2022年12月06日 0 点赞 0 评论 463 浏览 评分:9.9
题解: 蓝桥杯算法训练VIP-反置数【Python】 摘要:解题思路:转为字符串,逆序后再转为int参考代码:def func(num): num = [i for i in str(num)] return int(''.…… 题解列表 2022年12月06日 0 点赞 0 评论 427 浏览 评分:9.9
题解 : DNA【Python】 摘要:解题思路:对于一个单位的dna串,我们可以先打印其a-1行,重复b-1次,然后打印最后一行:参考代码:def dna(a): # 先创建 (a-1)*a 的二维列表,元素都为 空格'…… 题解列表 2022年12月06日 0 点赞 0 评论 757 浏览 评分:9.9
Cylinder题解简短易懂python 摘要:解题思路:注意事项:注意分两种情况讨论,还有不要自己定义pi。。。。参考代码:import mathpi=math.piwhile True: w,h=map(float,input().spl…… 题解列表 2022年12月05日 0 点赞 0 评论 609 浏览 评分:9.9
2792: 三角形判断 摘要:解题思路:注意事项:参考代码:a,b,c = map(int,input().strip().split())if a + b > c and a + c > b and b + c > a: …… 题解列表 2022年12月04日 0 点赞 0 评论 745 浏览 评分:0.0
2791: 计算邮资 摘要:解题思路:注意事项:参考代码:a, b = input().strip().split()a = int(a) ; b = str(b) # 这里的b转换类型只是为了增加程序可读性,可以不用转换…… 题解列表 2022年12月04日 0 点赞 0 评论 763 浏览 评分:8.0
2790: 分段函数 摘要:解题思路:注意事项:参考代码:import sysx = float(input())if x < 0 or x >= 20: sys.exit()elif x < 5: print(&#…… 题解列表 2022年12月03日 0 点赞 0 评论 538 浏览 评分:0.0