-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSocialFriends.c
83 lines (62 loc) · 2.12 KB
/
SocialFriends.c
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <stdio.h>
#include "simpio.h"
#include "genlib.h"
int main(){
bool comes_to_party[13];
char names[13][15]= {"Nikos","Lydia","Giannis","Eua","Manos","Petros","Akis","Eleni","Maria","Dimitris","Zoi","Alexandros","Anna"};
int like_dislike[13][13] = {0,1,0,0,0,0,1,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,1,0,0,0,0,0,0,
0,0,0,0,1,0,0,0,0,0,0,0,0,
0,0,0,1,0,0,1,1,0,0,0,0,0,
0,0,0,0,0,0,0,1,0,0,0,0,0,
1,0,1,0,1,0,0,0,0,0,0,0,0,
0,0,0,0,1,1,0,0,1,1,0,0,0,
0,0,0,0,0,0,0,1,0,1,0,1,0,
0,0,0,0,0,0,0,1,1,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,1,0,0,0,1,
0,0,0,0,0,0,0,0,0,0,0,1,0};
int i,j;
int max=13, sum[13];
for(i=0;i<14;i++){
sum[i] = 0;
comes_to_party[i]=TRUE;
for(j=0;j<14;j++){
if(like_dislike[i][j]==1){
sum[i] = sum[i] + 1;
}
}
}
int counter, k;
for(i=0;i<14;i++){
for(j=0;j<14;j++){
if(sum[i]==2 && like_dislike[i][j]==1){
counter = 0;
for(k=0;k<14;k++){
if(like_dislike[k][j]==1){
counter = counter + 1;
}
}
if(counter<2){
comes_to_party[i] = FALSE;
}
}
else if(sum[i]>2){
comes_to_party[i] = FALSE;
}
}
}
for(i=0;i<14;i++){
if(comes_to_party[i]==FALSE){
max--;
}
}
printf("Tha erthoun %d atoma sto party\n", max);
for(i=0;i<14;i++){
if(comes_to_party[i]==TRUE){
printf("%s\n", names[i]);
}
}
return 0;
}