-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNgnixServer.cpp
More file actions
33 lines (27 loc) · 785 Bytes
/
NgnixServer.cpp
File metadata and controls
33 lines (27 loc) · 785 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
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <utility>
using namespace std;
vector< pair<string, string> > servers;
int main() {
int server, duplicate;
scanf("%d %d", &server, &duplicate);
for(int i = 0; i < server; i++) {
string temp1, temp2;
cin >> temp1 >> temp2;
servers.push_back(make_pair(temp1,temp2));
}
for(int i = 0; i < duplicate; i++) {
string temp1, temp2;
cin >> temp1 >> temp2;
for(int i = 0; i < servers.size(); i++) {
if((servers[i].second).compare(temp2.substr(0, temp2.length() -1)) == 0) {
cout << temp1 << " " << temp2 << " #" << servers[i].first << '\n';
break;
}
}
}
return 0;
}