题目大意是求:对
取模。
当 k = 1时,
当 k = 2时,
当 k = 3时,
我们可以发现所求答案为k+1次多项式。我们只需要计算出k+2个点,然后应用拉格朗日插值法就可以得到此多项式。
#include<cstdio>
#include<cmath>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 8;
const ll mod = 1e9 + 7;
ll n, k, f[maxn], fac