题目:http://poj.org/problem?id=1472
思想是分而治之,核心是递归算法,重点是多项式乘法和加法
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define MAX 10
class Polynomial{
private:
struct Term{
int co, exp;
Term(int c, int e): co(c), exp(e){}
};
vector<Term> formula;//reverse of the normalized expression, each co > 0
private:
void reset(int arr[MAX + 1]){
formula.clear();
for(int i = 0, n = MAX; i <= n; ++i){
if(arr