Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はaを持っていて、set<int>その中の要素の数がx未満であるかどうかを確認したいと思います。(xもintです)
set<int>
私は何をすべきか?
lower_boundを計算するために使用しstd::distance(s.begin(), s.lower_bound(x))ます。(xがキーの場合、これは厳密に前 xの要素の数をカウントします。)
lower_bound
std::distance(s.begin(), s.lower_bound(x))
x