pat 1010:一元多項式導出
https://www.patest.cn/contests/pat-b-practise/1010
#include "stdio.h"
int main()
{
int i, num[100] = {0};
for(i = 0; i < 100; ++i)
{
scanf("%d", &num[i]);
if(0 == num[i])
break;
}
for(i = 0; num[i]; i+=2)
{
if(num[i+1]-1 > 0)
{
printf("%d ", num[i] * num[i+1]);
if(num[i+3] > 0)
printf("%d ", num[i+1]-1);
else
{
printf("%d
", num[i+1]-1);
break;
}
}
else
{
printf("%d 0
", num[i] * num[i+1]);
break;
}
}
return 0;
}