题目链接:https://www.patest.cn/contests/pat-b-practise/1010
解题思路:这道题很简单,但是有个坑,就是当没有任何非零项时,要输出0 0
#include <cstdio>
int main(){
int x,y;
int tag =0;
while(scanf("%d%d",&x,&y)!=EOF){
if(y!=0){
printf(tag==0?"%d %d":" %d %d",x*y,y-1);
tag =1;
}
}
if(tag==0) printf("0 0\n");
return 0;
}