#include<cstdio> #include<algorithm> int main(){ int a[1005] = {0}; int k,e,count = 0; //e是指数,k代表指数为e的项的系数 ,count用来计数求导后有多少不为0的项 while(scanf("%d %d",&k,&e)!=EOF){ a[e] = k; } for(int i=1;i<=1000;i++){ //从低到高枚举导数项,并且每次求完要将a[i]覆盖为0 a[i-1] = a[i]*i; a[i] = 0; //覆盖为0 if(a[i-1] != 0) count++; //即得到一个导数项不为0则加一 } if(count == 0){ printf("%d %d",0,0); } for(int i=1000;i>=0;i--){ //从高到低枚举输出导数项 if(a[i]!=0){ printf("%d %d",a[i],i); count--; if(count!=0) printf(" "); } } return 0; }