pat1010:一元多项式求导

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\n", num[i+1]-1);
				break;
			}
		}
		else
		{
			printf("%d 0\n", num[i] * num[i+1]);
			break;
		}
	}

	return 0;
}


你可能感兴趣的:(c,pat)