![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
我爱编程
西子云齐
自律即自由
展开
-
n个数随机抽取m个
0到n-1中随机输出m个数 // l0.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <time.h> #include<cstdlib> #include<iostream> using namespace std; //...原创 2018-09-22 16:19:15 · 1592 阅读 · 0 评论 -
分解质因数
// l0.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include&lt;iostream&gt; using namespace std; void zhiyinshu(int m, int n) { if (m &gt;= n) { ..原创 2018-09-22 16:38:10 · 537 阅读 · 0 评论 -
enum
enum // l0.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include<iostream> using namespace std; enum xx{ x1=1, //#《2》默认是从0开始,即x1=0,这里x1被设置为了1,那...原创 2018-09-22 20:54:13 · 2539 阅读 · 0 评论 -
安排座位不相邻
题设: n个系,输出不相邻排列的组合数,n个系的所有学生都要坐到座位上。 解析: 《1》n个系,按照最终人数由少到多排列为a1,a2,…,an 令N(c,b1,b2,…,bn)表示在{b1,b2,…,bn}人数时,同系学生两两分割的排列数,其中c=b1+b2+…+bn。 《2》来了第c+1位x系的同学,不妨设x=n系,现在N(c+1,b1,b2,…,bn+1)如何递归推导出来? 2.1 原来c位排...转载 2018-09-22 22:18:07 · 1622 阅读 · 0 评论