标签:begin bre str ber style tor space int cstring
#include<iostream> #include<vector> #include<algorithm> #include<cstring> #include<map> #include<set> #include<cstring> #include<stdio.h> #include<queue> using namespace std; char ch[5000]; int len; int main() { map<int, int> mp; vector<int>vec; int N, number; cin >> N; for(int i = 0; i < N; i++) { cin>>number; if(mp.find(number) == mp.end()) { vec.push_back(number); }else { vector<int>::iterator it = vec.begin() ; while(it != vec.end()) { if(*it == number) { vec.erase(it); break; } it++; } } mp[number]++; } if(vec.size() == 0) cout << "None"; else cout << vec[0]; }
其实不用删除也可以,直接都存下来,然后最后判断下 第一个 map 值为1的数字即为答案
标签:begin bre str ber style tor space int cstring
原文地址:https://www.cnblogs.com/dcklm/p/10350084.html