题解列表

筛选

python-矩阵加法

摘要:解题思路:注意事项:注意题目要求最后一行不要有多余空格参考代码:def f(n,m):       A = [[int(j) for j in input().strip().split()] fo……

2190: Little Ke's problem

摘要:解题思路:注意事项:参考代码:n = input() print(f"What is your name? Hello {n}, nice to meet you.")……

2189: diamond(python代码)

摘要:解题思路:注意事项:参考代码:n = int(input()) m = 1 for i in range(n//2):     print(' '*((n-m)//2)+&#39……

python-新生舞会

摘要:解题思路:开始想的是用对象解决,但是查询遍历的时间复杂度将达到O(n2),想想便放弃了,然后采用字典的方法,时间复杂度为O(n)。建立两个字典第一个字典键值为名字,值为性别第二个字典键值为学号,值为性……

1157: 亲和数

摘要:```python m=int(input()) l=[] k=[] for i in range(m): a,b=map(int,input().split()) for……

python-整数平均值

摘要:解题思路:貌似没有python的题解,加一下哈。注意事项:注意计算后的结果要取整。参考代码:def f(n):       A = [int(i) for i in input().strip().……

python-传球游戏

摘要:解题思路:开始我以为是一个递归的题目,写出程序之后数据较大的话时间就会超时。后来参考了别人的答案之后发现是用动态规划的算法。一楼楼主写的题解很好,大家可以去看看。这里也简单写以下思路吧首先建立一个(m……

快排 python 一点感悟

摘要:解题思路:左右互换的不知道为什么一直bug,换了个思路,替换得方法注意事项:参考代码:n=int(input())nums=list(map(int,input().split()))def quic……