[编程入门]筛选N以内的素数-题解(python代码) 摘要:解题思路: 素数即只有1和它本身两个因子,显然,若数x在(2,根号X)内没有因子,则它在(根号X,x-1)内没有因子,为减少循环(但此题不容易超时,所以可以不用减少循环),计算在(2, int(…… 题解列表 2022年01月24日 0 点赞 0 评论 419 浏览 评分:0.0
【编程入门】迭代法求平方根-题解(python) 摘要:解题思路: 根据所给公式写出相应代码,因为要迭代,所以利用python复合赋值。注意事项: 格式化输出保留三位小数。参考代码:x = int(input())a = x/2b = (a+x/a…… 题解列表 2022年01月24日 0 点赞 0 评论 446 浏览 评分:8.0
2191: Little Xie's issue(python代码) 摘要:解题思路:注意事项:参考代码:n = input() print('*'*(len(n)+4)) print('* '+n+' *') print…… 题解列表 2022年01月24日 0 点赞 0 评论 377 浏览 评分:0.0
python-矩阵加法 摘要:解题思路:注意事项:注意题目要求最后一行不要有多余空格参考代码:def f(n,m): A = [[int(j) for j in input().strip().split()] fo…… 题解列表 2022年01月24日 0 点赞 0 评论 448 浏览 评分:0.0
2190: Little Ke's problem 摘要:解题思路:注意事项:参考代码:n = input() print(f"What is your name? Hello {n}, nice to meet you.")…… 题解列表 2022年01月24日 0 点赞 0 评论 338 浏览 评分:0.0
2189: diamond(python代码) 摘要:解题思路:注意事项:参考代码:n = int(input()) m = 1 for i in range(n//2): print(' '*((n-m)//2)+'…… 题解列表 2022年01月24日 0 点赞 0 评论 279 浏览 评分:0.0
python-新生舞会 摘要:解题思路:开始想的是用对象解决,但是查询遍历的时间复杂度将达到O(n2),想想便放弃了,然后采用字典的方法,时间复杂度为O(n)。建立两个字典第一个字典键值为名字,值为性别第二个字典键值为学号,值为性…… 题解列表 2022年01月24日 0 点赞 0 评论 403 浏览 评分:0.0
1157: 亲和数 摘要:```python m=int(input()) l=[] k=[] for i in range(m): a,b=map(int,input().split()) for…… 题解列表 2022年01月24日 0 点赞 0 评论 431 浏览 评分:7.0
python-整数平均值 摘要:解题思路:貌似没有python的题解,加一下哈。注意事项:注意计算后的结果要取整。参考代码:def f(n): A = [int(i) for i in input().strip().…… 题解列表 2022年01月24日 1 点赞 0 评论 438 浏览 评分:0.0
python-传球游戏 摘要:解题思路:开始我以为是一个递归的题目,写出程序之后数据较大的话时间就会超时。后来参考了别人的答案之后发现是用动态规划的算法。一楼楼主写的题解很好,大家可以去看看。这里也简单写以下思路吧首先建立一个(m…… 题解列表 2022年01月24日 0 点赞 0 评论 630 浏览 评分:9.9