-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1318.cpp
More file actions
50 lines (37 loc) · 911 Bytes
/
1318.cpp
File metadata and controls
50 lines (37 loc) · 911 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
49
50
#include <iostream>
#include <vector>
using namespace std;
bool procuraNoVetor(vector<int> b, int num){
for(int j=0; j<b.size(); j++){
if(num == b[j]) {
return true;
}
}
return false;
}
int main(){
int aux = 0;
int n, m, bilhete;
vector<int> bilhetes;
vector<int> procurados;
while(true){
cin >> n >> m;
if(n == 0 & m == 0) break;
for(int i=0; i<m; i++){
cin >> bilhete;
int p = procuraNoVetor(bilhetes, bilhete);
int v = procuraNoVetor(procurados, bilhete);
if(p == 1 && v == 0){
aux++;
procurados.push_back(bilhete);
} else {
bilhetes.push_back(bilhete);
}
}
cout << aux << endl;
aux = 0;
bilhetes.clear();
procurados.clear();
}
return 0;
}