#include <stdio.h> #include <string.h> struct N{ int c; int e; }buf[1010],ans[1010]; int main() { freopen("data.in","r",stdin); freopen("d1.out","w",stdout); int x,y,index=0,k=0,i; while(scanf("%d%d",&x,&y)!=EOF) { buf[index].c=x; buf[index].e=y; if(buf[index].e==0) break; index++; } k=index; if(k==0) printf("0 0"); else { for(i=0;i<index-1;i++) { if(buf[i].e!=0) printf("%d %d ",buf[i].c*buf[i].e,buf[i].e-1); } printf("%d %d",buf[i].c*buf[i].e,buf[i].e-1); } return 0; }
来源:http://www.cnblogs.com/been/p/4244219.html