题解列表

筛选

python-新生舞会

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

A+B for Input-Output Practice (V)

摘要:解题思路:两层for循环,用数组存储相加所需数字注意事项:参考代码:#include<iostream>using namespace std;int main(){ int row, n;//row……

2189: diamond(python代码)

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

2190: Little Ke&#039;s problem

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

python-矩阵加法

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

[编程入门]筛选N以内的素数-题解(python代码)

摘要:解题思路:    素数即只有1和它本身两个因子,显然,若数x在(2,根号X)内没有因子,则它在(根号X,x-1)内没有因子,为减少循环(但此题不容易超时,所以可以不用减少循环),计算在(2, int(……

python计算数值距离

摘要:参考代码:k=[]a=list(map(int,input().split()))t=list(map(int,input().split()))c=t[:a[0]+1]s=list(map(int,……