給一組數字,判斷哪一個數只出現兩次
評分結果(參考) : AC (18ms, 332KB)
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
unordered_map<int, int> mp;
int num;
while(cin >> num){
mp[num]++;
}
for(auto& a : mp){
if(a.second == 2){
cout << a.first;
break;
}
}
return 0;
}