[小米OJ] 5. 找出旋转有序数列的中间值

排序,输出

#include <bits/stdc++.h>
using namespace std;
int main()
{
    string input;
    while (cin >> input)
    {
        istringstream iss(input);
        string temp;
        vector<int> vec;
        while (getline(iss, temp, ','))
        {
            vec.push_back(atoi(temp.c_str()));
        }
        sort(vec.begin(), vec.end());
        cout << vec[vec.size() / 2] << endl;
    }

    return 0;
}

猜你喜欢

转载自www.cnblogs.com/ruoh3kou/p/10280101.html