Created
March 9, 2017 02:15
-
-
Save hikilaka/24e85871c853519f2e9094526342d1e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> | |
struct less_than { | |
private: | |
const T a; | |
public: | |
less_than(const T a) : a(a) { } | |
bool operator()(const T &b) { | |
return b < a; | |
} | |
}; | |
int summaryProficiency(std::vector<int> a, int n, int m) { | |
a.erase(std::remove_if(a.begin(), a.end(), less_than<int>(m))); | |
a.resize(n, 0); | |
return std::accumulate(a.begin(), a.end(), 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment