117. Single Number

xiaoxiao2021-02-28  3

#include <cstdio> #include <iostream> #include <map> using namespace std; map<unsigned long long int, int> M; int main(void) { int n; while (scanf("%d", &n) != EOF) { M.clear(); while (n--) { unsigned long long int tmp; scanf("%llu", &tmp); if (M.find(tmp) == M.end()) { M[tmp] = 1; } else ++M[tmp]; } for (map<unsigned long long int, int>::iterator itor = M.begin(); itor != M.end(); ++itor) { if (itor->second != 3) { printf("%llu\n", itor->first); break; } } } return 0; }
转载请注明原文地址: https://www.6miu.com/read-1600085.html

最新回复(0)