-
Notifications
You must be signed in to change notification settings - Fork 0
/
naviParty.cpp
45 lines (40 loc) · 1001 Bytes
/
naviParty.cpp
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
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <stdlib>
using namespace std;
bool isnum(string s){
if ( s.size() != 0)
return false;
else if (s.size() == 2 && isdigit(s[0]))
return true;
else
return false;
}
int main(void){
int N,Q;
cin >> N >> Q;
set <string> names;
vector <int> ages;
while(N--) {
string temp;
cin >> temp;
names.insert(temp);
}
int count = 0;
while(Q--) {
string in;
cin >> in;
if(isnum(in)) {
int age = atoi(in);
if ( age <= 20)
count++;
}
else{
if(names.find(in) != names.end())
count++;
}
}
cout << count;
}