一、题目描述
这道题目本身的难度不大,主要是坑点比较多,以下列举一些我碰到的坑点
1.最后一个后面一定不要输出空格
2.如果指数为0是什么都不输出的,但是如果只有一个多项式而且指数是0的话,就要输出0 0
给出两个例子让大家理解一下本题的坑点
输入1:3 4 -5 2 6 1 -2 0
输出1:12 3 -10 1 6 0
输入2:7 0
输出2:0 0
三、代码
#include
#include
using namespace std;
struct loy
{
int fac;
int exp;
};
int main()
{
loy l[10000];
int n,m,cot=0;
while(scanf("%d %d",&n,&m)!=EOF)
{
l[cot].fac = n;
l[cot].exp = m;
cot++;
}
if(cot==1 && l[0].exp==0)
{
cout
关注
打赏