-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteamOlmpyd.c
33 lines (26 loc) · 850 Bytes
/
teamOlmpyd.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
#include <stdio.h>
int main() {
int numberOfStudents;
scanf("%d", &numberOfStudents);
int count1 = 0, count2 = 0, count3 = 0;
int indexes1[numberOfStudents], indexes2[numberOfStudents], indexes3[numberOfStudents];
for (int i = 0; i < numberOfStudents; i++) {
int input;
scanf("%d", &input);
if (input == 1) {
indexes1[count1++] = i + 1;
} else if (input == 2) {
indexes2[count2++] = i + 1;
} else if (input == 3) {
indexes3[count3++] = i + 1;
}
}
int teamcount = count1;
if (count2 < teamcount) teamcount = count2;
if (count3 < teamcount) teamcount = count3;
printf("%d\n", teamcount);
for (int i = 0; i < teamcount; i++) {
printf("%d %d %d\n", indexes1[i], indexes2[i], indexes3[i]);
}
return 0;
}