文章列表
一共三个文件
实现得很恶心,很多代码没效率
SCR.c
#include "SCR.h"
typedef enum mode_t {
CHARACTER = 3,
BACKGROUND = 4
} mode_t;
static struct termios orig;
static unsigned int term_init = 0;
void clear(void)
{
fprintf(stderr, "\033[2J");
}
int start_iaction(int sec, int ...
- 2009-06-05 20:17
- 浏览 795
- 评论(0)
就是求所有顶点对的最短路径长度
#include <iostream>
#include <vector>
using namespace std;
typedef struct{
int vexs[10];
int edges[10][10];
int n;
int e;
}MGraph;
#define INFINITE 2048
void CreateGraphM(MGraph *G){
int N1,N2;
cout<<"Enter the number of ...
- 2009-06-05 16:35
- 浏览 974
- 评论(0)
三种最短路径算法
Dijkstra:
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
typedef struct{
int vexs[10];
int edges[10][10];
int n;
int e;
}MGraph;
#define INFINITE 2048
void CreateGraphM(MGraph *G){
int N1,N2;
int i,j,k;
...
- 2009-06-05 16:33
- 浏览 1057
- 评论(0)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef struct{
int vexs[10];
int edges[10][10];
int n;
int e;
}MGraph;
#define INFINITE 2048
void CreateGraphM(MGraph *G){
int N1,N2;
int i,j,k;
cout<<& ...
- 2009-05-31 15:26
- 浏览 745
- 评论(0)
#include <iostream>
#include <vector>
using namespace std;
#define EXCHANGE(a,b) \
({typeof(a) _tmp; \
_tmp=a; \
a=b; \
b=_tmp;})
...
- 2009-05-31 03:34
- 浏览 935
- 评论(0)
//有向图判断是否有环
#include <iostream>
#include <list>
#include <vector>
#include <algorithm>
using namespace std;
#define TRUE 1
#define FALSE 0
typedef struct{
int vexs[10];
int edges[10][10];
int n;
int e;
}MGraph;
void CreateGraphM(MGraph *G){ ...
- 2009-05-31 03:30
- 浏览 4491
- 评论(0)
#include <iostream>
//有向图的强连通分量
//翻转边集 深度优先遍历
using namespace std;
typedef struct{
int vexs[10];
int edges[10][10];
int n;
int e;
}MGraph;
void CreateGraphM(MGraph *G){
int N1,N2;
int i,j,k;
printf("Enter the number of vertexs and edges: \n");
...
- 2009-05-31 03:26
- 浏览 1340
- 评论(0)
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define EXCHANGE(a,b) \
({typeof(a) _tmp; \
_tmp=a; \
a=b; ...
- 2009-05-31 03:02
- 浏览 694
- 评论(0)
#include <iostream>
#include <set>
using namespace std;
#include "IO.hpp"
void SIEVE(set<int>& primes,int limit){
int index;
primes.erase(primes.begin(),primes.end());
for(int i=2;i<limit;i++)
primes.insert(i);
for(int i=2;i*i& ...
- 2009-05-31 02:56
- 浏览 902
- 评论(0)
#include <iostream>
#include <vector>
#include <math.h>
#include <time.h>
#include <algorithm>
using namespace std;
unsigned long long MOD_EXP(unsigned long long A,\
unsigned long long B,\
unsigned lon ...
- 2009-05-31 02:39
- 浏览 1471
- 评论(0)