7-16 一元多项式求导(vector)
输入样例:
3 4 -5 2 6 1 -2 0
输出样例:
12 3 -10 1 6 0
代码:
#include<iostream>
#include<vector>
using namespace std;
vector<int>v1,v2;
int main(){int x,y;while(scanf("%d%d",&x,&y)!=EOF){if(y) v1.push_back(x),v2.push_back(y);}int temp=v1.size();for(int i=0;i<temp-1;i++){printf("%d %d ",v1[i]*v2[i],v2[i]-1);}if(temp>0) printf("%d %d",v1[temp-1]*v2[temp-1],v2[temp-1]-1);else printf("0 0");return 0;
}