1023

作者: 峡迩 | 来源:发表于2017-07-27 20:31 被阅读0次
    #include<iostream>
    #include<string>
    #include<vector>
    #include<map>
    
    
    using namespace std;
    
    const vector<int> &to_minnum(vector<int> &a)
    {
        if (a[0] == 0)
        {
            for (auto &r : a)
            {
                if (r != 0)
                {
                    int tmp = r;
                    r = a[0];
                    a[0] = tmp;
                    break;
                }   
            }
        }
    
        return a;
    }
    
    int main()
    {
        vector<int> in_num;
        vector<int>::size_type num = 0;
        int tmp;
        while (num < 10)
        {
            if (cin >> tmp)
            {
                for (int i = 0; i < tmp; ++i)
                {
                    in_num.push_back(num);
                }
                ++num;
            }
        }
        vector<int> a = to_minnum(in_num);
        for (auto &r : a)
        {
            cout<<r;
        }
    
        cout << endl;
        system("pause");
        return 0;
    }
    

    相关文章

      网友评论

          本文标题:1023

          本文链接:https://www.haomeiwen.com/subject/fujtlxtx.html