ACM UVA-498

多項式

int main(int argc, char const* argv[])
{
    string c,x;
    while(getline(cin,c) && getline(cin,x)){
        vector<int> xx;
        istringstream stream1(x);
        int xn;
        while(stream1>>xn){
            xx.push_back(xn);
        }
        vector<int> cc;
        istringstream stream2(c);
        int cn;
        while(stream2>>cn){
            cc.push_back(cn);
        }
        int lx = xx.size(); 
        for(int i = 0;i<lx;i++){
            int sum = cc[0];
            int lc = cc.size();
            for(int j = 1;j<lc;j++){
                sum = sum*xx[i]+cc[j];
            }
            if(i == 0){
                printf("%d",sum);
            }else{
                printf(" %d",sum) ;
            }
        }
        printf("\n");
    }

    return 0;
}