We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d21f30b commit b0ddce8Copy full SHA for b0ddce8
2 files changed
src/alfred/math/mod-int.hpp
@@ -46,7 +46,6 @@ class ModInt {
46
if (n < 0) {
47
n = (-n) % (M - 1) * (M - 2);
48
}
49
- n %= (M - 1);
50
while (n) {
51
if (n & 1) res *= x;
52
x *= x;
src/alfred/math/utils.hpp
@@ -31,6 +31,11 @@ inline T isqrt(T x) {
31
return res;
32
33
34
+template <class T, class V>
35
+inline bool in_range(V v, T l, T r) {
36
+ return l <= v && v <= r;
37
+}
38
+
39
// Given in integer n. Returns (primes, minp)
40
std::pair<std::vector<int>, std::vector<int>> euler_sieve(int n) {
41
std::vector<int> primes, minp(n + 1);
0 commit comments