坑点
当没有合适的输出内容时, 需要输出0 0
#include <iostream>
#include <cstdio>
#include <string>
#include <unordered_map>
using namespace std;
const int N = 1e3+7;
struct node{
int coef;
int exp;
}E[N];
int main(){
char ch;
int i = 0;
while(cin>>E[i].coef>>E[i].exp){
ch = getchar();
i++;
if(ch == '\n') break;
}
bool flag = false;
for(int j = 0; j < i; j++){
int e = E[j].exp - 1;
int c = E[j].exp * E[j].coef;
if(c != 0){
flag = true;
if(j==0) cout<<c<<" "<<e;
else cout<<" "<<c<<" "<<e;
}
}
if(!flag) puts("0 0");
return 0;
}