- 博客(3)
- 收藏
- 关注
原创 python生成器求π
from math import sqrt def fun(): a = sqrt(2) / 2 b = sqrt(a * 2 + 2) / 2 yield a yield b while True: a = b b = sqrt(a * 2 + 2) / 2 yield b N = int(input()) f = fun(); p = 1.0 for i in range(N + 1): p *= ne
2020-05-23 12:01:11
427
原创 C++,排列组合算法
组合我就不写了,重点是这个排列算法 我用vector容器的原因是他有自动缩进的功能 如果不喜欢也可以写个单链表 #include<iostream> #include<vector> using namespace std; int(*p)[5] = new int[120][5];//用来装排列完成的数据的数组指针 我这个算法的核心就是这个size,能看懂的就细细的品一下 通过控制size的大小,来递归求排列 /* @vec 用于排列的数据 @a 表示的是二维数组的第a个 @b
2020-05-19 17:32:40
434
原创 线性代数,行列式求值。
第一次发代码,来试试水~~ #include<iostream> #include<vector> using namespace std; using Vector = vector<vector<int>>; class D { protected: int num; int level; Vector arr; public: D():num(1), level(1) {} int(*x)[5] = new int[120][5];
2020-05-18 08:49:19
527
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人