1010 一元多项式求导 测试点2、4

易错点

测试点2、4:当输入只有指数为0的数,这时候输出要特别设置为“0 0”

代码

#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
	int a,b;
	int tmp=0;
	while(cin>>a>>b){
		if(b!=0){
			if(tmp==0){
				cout<<a*b<<" "<<b-1;
				tmp=1;
			}
			else{
				cout<<" "<<a*b<<" "<<b-1;
			}
		}
		else if(b==0){

		}
	} 
	if(tmp==0){
		cout<<"0 0";
	}
	return 0;
}
posted @ 2022-07-16 11:43  qwasdasd  阅读(51)  评论(0)    收藏  举报