class Solution {
public:
vector<int> findNumbersWithSum(vector<int>& nums, int target) {
unordered_set<int> S;//设置一个容器
for (auto x : nums)
{
if (S.count(target - x)) return {x, target - x};//如果找到符合条件的数,直接输出
S.insert(x);//储存数组中的数字
}
}
};