- 博客(29)
- 收藏
- 关注
转载 绘制金刚石图案
因文字图片过长,可下载文档查看 http://www.doc88.com/p-9963865542355.html 转载于:https://my.oschina.net/u/376123...
2018-11-04 23:33:00
663
转载 最小重量机器问题
/*最小重量机器问题*/#include<stdio.h> int w[100][100]; //w[i][j]为第i个零件在第j个供应商的重量 int c[100][100]; //c[i][j]为第i个零件在第j个供应商的价格 int bestx[100]...
2018-11-04 23:07:00
229
转载 图的m着色问题
#include<stdio.h>int color[100],sum; bool ok(int k,int c[100][100]){ for(int i=1;i<k;i++) if((c[k][i]==1)&...
2018-11-04 23:04:00
178
转载 汽车加油问题
#include<stdio.h>int greedy(int x[],int n,int k){ int sum=0; for(int j=0;j<=k;j++){ if(x[j]>n) { printf("No So...
2018-11-04 23:00:00
367
转载 棋盘覆盖问题 —— 分治法
/*分治法实现棋盘覆盖问题*/#include<stdio.h>//tr:棋盘左上角方格的行号 tc:棋盘左上角方格的列号//dr:特殊方格的行号 dc:特殊方法的列号//size:size=2的k次方,棋盘规格为2的k次方//tile:L型骨牌...
2018-11-04 22:58:00
143
转载 旅行售货商问题 -- 回溯法
/*旅行售货员问题回溯法*/#include<stdio.h> #define N 4 int cc,//当前路径费用 bestc;//当前最优解费用 int a[N+1][N+1];//邻接矩阵,存放图的信息 int bestx[N+1...
2018-11-04 22:51:00
734
转载 旅行售货商问题 1
#include<iostream> using namespace std; const int INF = 10000000; int n, cc = 0, bestc = INF; int **g; int *x, *bestx; v...
2018-11-04 22:48:00
184
转载 二分搜索的非递归实现
/*非递归二分查找*/#include<stdio.h>void main(){ int a[10]={11,21,31,41,51,61,71,81,91,101}; int low=0,high=9; int key; printf("请输入要查找的数:...
2018-11-04 21:47:00
156
转载 二分搜索的递归实现
/*递归二分查找*/#include<stdio.h>int select(int a[],int low,int high,int key);void main(){ int a[10]={11,21,31,41,51,61,71,81,91,101}; in...
2018-11-04 21:44:00
370
转载 独立任务最优调度问题
#include <stdio.h> int main() { int n; int *a, *b,*t; int i,k; int sa=0; int result=1000000; ...
2018-11-04 21:42:00
105
转载 Huffman Tree -- Huffman编码
#include <stdlib.h> #include <stdio.h> #include <string.h>typedef struct HuffmanTree { int weight; int parent, ...
2018-11-04 21:39:00
181
转载 01背包问题 -- 回溯法 2
/*0-1背包伪代码*/#include <iostream> using namespace std; template<class Typew,class Typep> class Knap //Knap类记录解空间树的...
2018-11-04 21:26:00
373
转载 01背包问题 -- 回溯法 1
/*0-1背包回溯法实现*/#include <stdio.h>#include <conio.h>int n; //物品数量double c; //背包容量double v[100]; //各个物品的价值double w[100];...
2018-11-04 21:23:00
303
转载 01背包问题 -- 动态规划
/*0-1背包问题*/#include<stdio.h> int V[200][200]; //前i个物品装入容量为j的背包中获得的最大价值 int max(int a,int b) { if(a>=b) return...
2018-11-04 21:19:00
185
转载 进程调度算法 (总)
// sun.cpp : 定义控制台应用程序的入口点。//本算法包含四种调度:先到先服务,短作业优先,时间片轮转,优先级调度#include<stdio.h>#define N 50void main(){ void fcfs(); /...
2018-11-03 13:48:00
160
转载 磁盘调度算法
#include<stdio.h>#include<stdlib.h>#include<iostream.h>#include<math.h>#define maxsize 1000/*********************...
2018-11-03 13:44:00
228
转载 页面置换算法 2
#include<stdio.h>#include<stdlib.h>#include<windows.h>void Print(int bc[],int blockCount) { int i; for(i=0;i<...
2018-11-03 13:39:00
134
转载 页面置换算法 1
#include <stdio.h>#include <stdlib.h>/*全局变量*/int mSIZE; //物理块数int pSIZE; //页面号引用串个数static int memery[10]={0}; //物理...
2018-11-03 13:37:00
148
转载 银行家问题2
#include <iostream.h>////////////////////////////////////////////////////////////////////////////全局变量定义int Available[100]; //可利用资源数组i...
2018-11-03 13:34:00
171
转载 银行家问题1
#include <stdio.h>int curr[5][5], maxclaim[5][5], avl[5];int alloc[5] = {0, 0, 0, 0, 0};//已分配的资源int maxres[5], running[5], safe=0;int...
2018-11-03 13:31:00
310
转载 进程调度算法 —— 非抢占式优先级调度算法
/*非抢占式优先级调度算法*/#include <iostream>using namespace std;struct Num{ int priority; //优先级 int dt; //到达时间 int st; //运行时间}su...
2018-11-03 13:26:00
6314
转载 进程调度算法 —— 抢占式优先级调度
/*抢占式优先级调度算法*/#include <iostream>using namespace std;struct Num{ int priority; //优先级 int dt; //到达时间 int st; //运行时间 int...
2018-11-03 13:23:00
4204
转载 进程调度算法 —— 时间片轮转调度
/*时间片轮转调度算法*/#include<stdio.h>#define MAX 50struct a_struct{ char name[10]; //进程名字 int number; //进程编号 float dt; //到达时间 f...
2018-11-03 13:21:00
292
转载 进程调度算法 —— 短作业优先调度
/* 短作业优先调度 */#include <stdio.h>struct sjf{ char name[10]; float dt;//到达时间 float st;//服务时间 float begin_time;//开始运行时间 float wct;/...
2018-11-03 13:16:00
400
转载 进程调度算法 —— 先来先服务
/* 先来先服务 */#include<stdio.h>#define MAX 50struct Gzuo{ int id; //进程名字 int dt; //到达时刻 int st; //服务时间 int wct; //完成时刻 float ...
2018-11-03 13:12:00
605
转载 编译原理实验 —— 语法分析器
/*待分析的简单语言的语法用扩充的BNF表示如下:⑴<程序>::=begin<语句串>end⑵<语句串>::=<语句>{;<语句>}⑶<语句>::=<赋值语句>⑷<赋值语句>...
2018-11-03 12:41:00
743
转载 编译原理实验 —— 词法分析器
// Lexical_Analysis.cpp : 定义控制台应用程序的入口点。//#include "stdio.h"#include "stdlib.h"#include "string.h"#include "iostream"using namespace st...
2018-11-03 12:32:00
165
转载 应用--学生宿舍卫生管理系统
#include<stdio.h>#include<conio.h>#include<string.h>#include<stdlib.h>#include<time.h>#define N 400 //最...
2018-10-11 09:51:00
364
转载 C语言经典程序100例
【程序1】 题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月 后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? 1.程序分析: 兔子的规律为数列1,1,2,3,5,8,13,21.... 2.程序源代码: #include&l...
2018-10-03 13:11:00
404
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人