-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1789.cpp
More file actions
55 lines (47 loc) · 1.02 KB
/
1789.cpp
File metadata and controls
55 lines (47 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*************************************************************************
> File Name: 1789.cpp
> Author: dulun
> Mail: [email protected]
> Created Time: 2016年01月26日 星期二 11时15分18秒
************************************************************************/
#include<iostream>
#include<stdio.h>
using namespace std;
const int inf = 10;
const int large = 2001;
int n;
char str[large][8];
int dist[large][large] = {0};
int weight(int i, int j)
{
int w = 0;
for(int k=0; i<7; k++)
{
if(str[i][k] != str[j][k]) w++;
}
return w;
}
int prim()
{
bool visit[large];
int prim_w = 0;
int min_w;
int k, t = n;
int low[large];
memset(visit, false, sizeof(u));
visit[s] = true;
for(int i = 0; i < n; i++)
{
low[i] = inf;
}
while(t--)
{
for(int i = 0; i < n; i++)
{
min_w = inf;
if(!visit[i] && low[i] > min_w )
k = i, min_w = low[i];
}
visit[k] = true;
}
}