苦行修士_
苦行修士_
全部文章
分类
归档
标签
去牛客网
登录
/
注册
苦行修士_的博客
全部文章
(共9篇)
题解 | 用户分群
import math import numpy as np K=int(input()) ls=[[] for _ in range(K)]#用来存放K个初始中心的 ly=[[] for _ in range(K)]#用来存放新的中心的 for i in range(K): ls[i]=l...
2026-03-12
0
8
题解 | 使用简化阶梯型矩阵的方法求行列式
import numpy as np def determinant_4x4(matrix) : matrix=np.array(matrix,dtype=float) Q=[] for i in range(4): piw=i while ...
2026-02-28
0
32
题解 | 使用拉普拉斯展开式的 4x4 矩阵的行列式
import numpy as np def determinant_4x4(A) : A=np.array(A) if A.shape[0]==2: return A[0][0]*A[1][1]-A[0][1]*A[1][0] else: ...
2026-02-28
0
26
题解 | 实现简化行阶梯形(RREF)函数
import numpy as np def rref(matrix): l=matrix.shape[0] for i in range(l): piw=i while piw<l-1 and abs(matrix[piw][i])<1...
2026-02-27
0
20
题解 | Gauss-Seidel法求解线性方程组
import numpy as np def gauss_seidel(A, b, n, x_ini=None): X=np.zeros(len(b)) l=A.shape[0] h=A.shape[1] for k in range(n): X_n...
2026-02-27
0
21
题解 | 实现简化行阶梯形(RREF)函数
import numpy as np def rref(matrix): l=matrix.shape[0] h=matrix.shape[1] for i in range(l): if int(matrix[i][i])==0: ...
2026-02-27
0
21
题解 | 杨辉三角
q=int(input()) def C(n,r):#定义组合数的计算 b=1 a=1 if r==0: return 1 else: for i in range(1,r+1): b=b*i ...
2026-01-25
0
32
题解 | 矩阵交换
n,m=map(int,input().split()) ls=[] for i in range(n): o=list(map(int,input().split())) ls.append(o) ly=[row.copy() for row in ls] # 1️⃣ 初...
2026-01-24
0
31
题解 | KiKi求质数个数
p=0 for i in range(100,1000): s=0 for j in [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,51]: if i%j!=0: s+=1 if s==16...
2026-01-22
0
32