Skip to content

Commit e1f9704

Browse files
committed
Fixed some bugs.
1 parent 401dfa5 commit e1f9704

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/alfred/math/lagrange.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33

44
#include "comb.hpp"
55
#include "vec-inv.hpp"
6+
#include <algorithm>
67
#include <cassert>
7-
#include <iostream>
88
#include <vector>
99

10-
// TODO: write lagrange as a class, supporting: O(n^2) init, O(n) query
11-
1210
template <class mint>
1311
class Lagrange {
1412
private:
@@ -99,7 +97,7 @@ inline mint sum_of_kth_powers(mint n, int k) {
9997
mint sum = 0;
10098
std::vector<mint> Y{0};
10199
for (int i = 1; i <= k + 2; i++) {
102-
Y.push_back(sum += (mint)i ^ k);
100+
Y.push_back(sum += mint(i).pow(k));
103101
}
104102
return cont_lagrange(Y, n);
105103
}

0 commit comments

Comments
 (0)