/* SRM 673 D2 250-pointer (BearSong) James S. Plank Tue Aug 30 00:44:31 EDT 2016 */ #include #include #include #include #include #include using namespace std; class BearSong { public: int countRareNotes(vector notes); }; int BearSong::countRareNotes(vector N) { int i; map Count; map ::iterator cit; int rv; /* Set Count[i] to be the number of times that pitch i appears in the song */ for (i = 0; i < N.size(); i++) Count[N[i]]++; /* Increment rv once for every note that appears exactly once. */ rv = 0; for (cit = Count.begin(); cit != Count.end(); cit++) { if (cit->second == 1) rv++; } return rv; }