1010

2017-07-16  本文已影响0人  峡迩
#include<iostream>
#include<sstream>
#include<string>
#include<vector>


using namespace std;

int main()
{
    vector<int> in;
    string s;
    if (getline(cin, s))
    {
        istringstream in_tmp(s);
        int tmp;
        while (in_tmp >> tmp)
        {
            in.push_back(tmp);
        }
    }

    auto beg = in.cbegin();
    string out;

    if (*(beg + 1) == 0)
        out=string("0 0 ");
    else
    {
        for (; beg != in.cend(); beg = beg + 2)
        {
            if(*(beg+1)!=0)
                out = out + to_string((*beg)*(*(beg + 1))) + string(" ")+to_string(*(beg + 1) - 1)+string(" ");
        }
    }
    cout << out.substr(0, out.size() - 1);

    system("pause");
    return 0;
}
上一篇 下一篇

猜你喜欢

热点阅读