您当前的位置: 首页 > 

MangataTS

暂无认证

  • 3浏览

    0关注

    423博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

L2-018 多项式A除以B(模拟)

MangataTS 发布时间:2022-04-05 16:58:46 ,浏览量:3

题目连接

https://pintia.cn/problem-sets/994805046380707840/problems/994805060372905984

思路

其实就是一个多项式的除法运算,我们尽可能将 B B B 的最大项凑到和 A的对应位置项同阶,然后做一个减法运算即可,详情请参考代码,注意的是这里有几个坑点:

  • 余数的阶数小于商的阶数:测试点3、4
  • 去除商中的零项:测试点1、4
  • B的最大阶比A大:测试点2、3
代码
#include
using namespace std;
#define ll long long
#define mod 1000000007
#define endl "\n"
#define PII pair
#define INF 0x3f3f3f3f

const int N = 2e4 + 10;

double a[N], b[N], q[N];

struct Node {
	int e;
	double c;
};

void print(vector &ans) {
	int l = ans.size();
	cout             
关注
打赏
1665836431
查看更多评论
0.0429s