自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(6)
  • 收藏
  • 关注

原创 动态规划完全背包

动态规划多重背包 #include <iostream> using namespace std; int n=3; int w[]={3,4,2}; int v[]={4,5,3}; int W=7; //f是指标函数 //s是状态变量 //k是阶段变量 int f(int s,int k) { if(s<=0||k>n) return 0; else if(s&...

2019-03-23 21:20:31 337

原创 哈夫曼编码C语言

哈夫曼树 #include <stdio.h> //哈夫曼树节点个数为2n-1 //n为叶子节点的个数 //故MAX_NODE>2n-1 #define MAX_NODE 200 #define MAX_SIZE 40 #define INF 32767 //哈夫曼树的数据结构 typedef struct { //权重 float weight ;...

2019-03-23 15:58:35 519

原创 从n个数中选出k个数

从n个数中选出k个数 #include <iostream> #include <vector> #include <algorithm> using namespace std; vector<int> a; vector<int> b; void fun(int a) { cout << a << " "; ...

2019-03-23 10:07:46 2632

原创 求N个数的最大公约数和最小公倍数

求N个数的最大公约数和最小公倍数 #include <iostream> #include <cmath> using namespace std; //[15,40] [40,15] [15 10] [10 5] [5 0] //求两个数的最大公约数 int gcd(int a,int b) { if(b==0) { return a; } else { ...

2019-03-23 01:02:51 450

原创 C/C++产生区间随机整数或小数的方法

C/C++产生区间随机整数或小数的方法 #include <iostream> #include <queue> #include <cstdlib> #include <ctime> const int MIN = 0; const int MAX = 99; using namespace std; int main(){ //prior...

2019-03-19 21:01:57 1851

原创 C/C++二维数组传参方法

C++二维数组传参方法 #include <stdio.h> #include <iostream> const int M=5; const int N=5; using namespace std; void array_init_v1(int A[][N]) { int i,j,count=0; for(i=0;...

2019-03-18 22:48:44 398 2

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除