本文主要是介绍点名,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
解法:
map
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
#define endl '\n'int main()
{ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);int n;cin >> n;int a;string s;map<int, string> mp;map<string, int> mpis;while (n--) {cin >> a >> s;mp[a] = s;mpis[s] = 1;}int k; cin >> k;while (k--) {cin >> s >> a;if (mpis[s]) {if (mp.find(a) == mp.end()) {mp[a] = "ti";}}}int m; cin >> m;while (m--) {cin >> a;if (mp.find(a) != mp.end()) {cout << "no" << endl;}else cout << "yes" << endl;}return 0;
}
这篇关于点名的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!