-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1407.cpp
More file actions
48 lines (35 loc) · 961 Bytes
/
1407.cpp
File metadata and controls
48 lines (35 loc) · 961 Bytes
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
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main() {
int n, c, k, num, menor;
map<int, int> sorteios;
vector<int> numeros;
while(true) {
cin >> n >> c >> k;
if(n == 0 && c == 0 && k == 0) break;
for(int l=0; l<k; l++) sorteios[l] = 0;
for(int i=0; i<n; i++) {
for(int j=0; j<c; j++){
cin >> num;
sorteios[num-1]++;
}
}
menor = n;
for(auto s : sorteios){
if(s.second < menor) menor = s.second;
}
for(auto si : sorteios){
if(si.second == menor) numeros.push_back(si.first);
}
for(int j=0; j<numeros.size(); j++){
if(j == numeros.size() - 1) cout << numeros[j] + 1;
else cout << numeros[j] + 1 << " ";
}
cout << endl;
sorteios.clear();
numeros.clear();
}
return 0;
}