运行 ❯
建立您
自己的
网站
×
更改方向
更改主题,深色/浅色
前往 Spaces
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { vector<int> numbers = {1, 7, 3, 5, 9, 2}; auto it = is_sorted_until(numbers.begin(), numbers.end()); int position = it - numbers.begin(); cout << "The first " << position << " items are in ascending order."; return 0; }
前2个项目是按升序排列的。