Files
PAT/PATBasic/1010.c
2022-01-08 03:01:51 +08:00

20 lines
326 B
C

#include <stdio.h>
int main()
{
int coef, index, count = 0;
while (scanf("%d %d", &coef, &index) != EOF) {
if (index) { /* Constant terms result in zero */
if (count++) putchar(' ');
printf("%d %d", coef * index, index - 1);
}
}
/* Zero polynomial or constant */
if (count == 0)
puts("0 0");
return 0;
}