https://atcoder.jp/contests/abc245/tasks/abc245_d
题目大意:
n个数字,代表A(X)=a[0]*X^0 + a[1]*X^1 + ...... +a[n]*X^n;
m个数字,代表B(X)=b[0]*X^0 + b[1]*X^1 + ...... +b[n]*X^m;
定义C(X)=A(X)*B(X)=(a[0]*X^0 + a[1]*X^1 + ...... +a[n]*X^n)*(b[0]*X^0 + b[1]*X^1 + ...... +b[n]*X^m);
已知A和C的位数以及系数分别是什么,让我们求出B的系数?
Sample Input 1
1 2
2 1
12 14 8 2
Sample Output 1
6 4 2
Sample Input 2
1 1
100 1
10000 0 -1
Sample Output 2
100 -1
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
const LL N=200200,M=2002;
LL a[N],b[N],c[N];
int main()
{
cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
int T=1;
//cin>>T;
while(T--)
{
LL n,m;
cin>>n>>m;
for(LL i=0;i<=n;i++)
cin>>a[i];
for(LL i=0;i<=n+m;i++)
cin>>c[i];
for(LL i=m;i>=0;i--)
{
b[i]=c[n+i]/a[n];
for(LL j=0;j<=n;j++)
{
c[i+j]-=a[j]*b[i];
}
}
for(LL i=0;i<=m;i++)
cout<<b[i]<<" ";
cout<<endl;
}
return 0;
}
标签:division,ABC,Sample,int,LL,cin,245,Input,......
From: https://www.cnblogs.com/Vivian-0918/p/16739478.html