-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1078_2.cpp
More file actions
55 lines (49 loc) · 1.09 KB
/
1078_2.cpp
File metadata and controls
55 lines (49 loc) · 1.09 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: 1078_2.cpp
> Author: dulun
> Mail: [email protected]
> Created Time: 2015年12月02日 星期三 21时36分41秒
************************************************************************/
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int n;
cin>>n;
int sum = 0;
int k_v[100] = {0};
int a[100][100];
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
cin>>a[i][j];
}
}
cout<<"adfasfa";
int min = 99999999;
int count = 0;
int i, j, p, q;
while(count < n-1)
{
min = 99999999;
for(i = 0; i < n-1; i++)
{
for(j = i+1; j < n; j++)
{
if(a[i][j] < min && (k_v[i] != 1 || k_v[j] != 1) )
{
min = a[i][j];
p = i; q = j;
}
}
}
k_v[p] = 1;
k_v[q] = 1;
count ++;
sum += min;
}
cout<<sum;
return 0;
}