社区讨论

非得用map吗?

B3927[GESP202312 四级] 小杨的字典参与者 4已保存回复 5

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
5 条
当前快照
1 份
快照标识符
@lxvwd43k
此快照首次捕获于
2024/06/26 21:54
2 年前
此快照最后确认于
2024/06/27 11:14
2 年前
查看原帖
俺是个蒟蒻,用string结构体简单明了地写出来了啊(代码就不展示了)
CPP
#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不了)

回复

5 条回复,欢迎继续交流。

正在加载回复...