非得用map吗?
查看原帖
非得用map吗?
823830
mcturtle楼主2024/6/26 21:53

俺是个蒟蒻,用string结构体简单明了地写出来了啊(代码就不展示了)

#include<bits/stdc++.h>
using namespace std;
struct node{
	string a, b;
};
vector <node> dic;
string search(string t){//string搜索函数模版(上网寻求帮助的)
	auto it = std::find_if(dic.begin(), dic.end(), [&](const node& ms) {
		return ms.a == t;
	});
	if(it != dic.end()){
		return it->b;	
	}
	return "";	
}
int main(){
	//初始化
	//循环
	//特判!!!!
	return 0;
}

一定要记得最后要特判一下(不然AC不了)

2024/6/26 21:53
加载中...