[小米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;
}

 

posted @ 2019-01-16 23:39  Ruohua3kou  阅读(279)  评论(0编辑  收藏  举报