题解:
分情况:
非零多项式
b=0 过滤
b!=0 控制格式输出
零多项式
0 0
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a , b , f= 0;
while (sc.hasNext()) {
a = sc.nextInt();
b = sc.nextInt();
if(b!=0){
if (f==0)
System.out.print(a*b);
else
System.out.print(" "+a*b);
System.out.print(" "+(b-1));
f=1;
}
}
if (f==0)
System.out.print("0 0");
}
}