小白1-J--stl map

 

 

 

 

 

 

#include<iostream>
#include<cstring>
using namespace std;
int main() {
string s1;
string s2;
string s3;
string s4;
cin >> s1 >> s2 >> s4 >> s3 >> s4 >> s4;
int n;
cin >> n;
while (n--) {
string s;
cin >> s;
if (s != s1 && s != s2 && s != s3)
cout << "Fake" << endl;
else {
if (s == s2)cout << s1 << endl;
else if (s == s3)cout << s2 << endl;
else cout << s3 << endl;
}
}
}

 

 

s4用来缓存重复输入的string 然后后面每输入一次就判断和输出即可

 

下面是其他学者用stl的map值得学习

https://blog.csdn.net/memory_qianxiao/article/details/79597022

 

posted @ 2020-05-07 10:43  罗霖锦  阅读(120)  评论(0编辑  收藏  举报