-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy path0094.cpp
More file actions
40 lines (37 loc) · 776 Bytes
/
0094.cpp
File metadata and controls
40 lines (37 loc) · 776 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
// 0094.记票统计
#include <iostream>
#include <map>
using namespace std;
int main()
{
int n,m;
while(cin >> n)
{
getchar();
string s1[1000], s2[1000];
map<string,int> mp;
int cnt = 0;
for (int i = 0; i < n; i++)
{
cin >> s1[i];
mp[s1[i]] = 0;
}
cin >> m;
getchar();
for (int i = 0; i < m; i++)
{
cin >> s2[i];
if (mp.find(s2[i]) != mp.end()) {
mp[s2[i]] ++;
}else {
cnt ++;
}
}
for (int i = 0; i < n; i++)
{
cout << s1[i] << " : " << mp[s1[i]] << endl;
}
cout << "Invalid : " << cnt << endl;
}
return 0;
}