Skip to content

Commit ebb7b79

Browse files
authored
Fix self-divisible condition in README code
1 parent b8281b5 commit ebb7b79

File tree

1 file changed

+2
-2
lines changed
  • solution/2900-2999/2992.Number of Self-Divisible Permutations

1 file changed

+2
-2
lines changed

solution/2900-2999/2992.Number of Self-Divisible Permutations/README_EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class Solution:
106106
return 1
107107
ans = 0
108108
for j in range(1, n + 1):
109-
if (mask >> j & 1) == 0 and (i % j == 0 or j % i == 0):
109+
if (mask >> j & 1) == 0 and gcd(i, j) == 1:
110110
ans += dfs(mask | 1 << j)
111111
return ans
112112

@@ -265,7 +265,7 @@ class Solution:
265265
for mask in range(1 << n):
266266
i = mask.bit_count()
267267
for j in range(1, n + 1):
268-
if (mask >> (j - 1) & 1) == 1 and (i % j == 0 or j % i == 0):
268+
if (mask >> (j - 1) & 1) == 1 and gcd(i, j) == 1:
269269
f[mask] += f[mask ^ (1 << (j - 1))]
270270
return f[-1]
271271
```

0 commit comments

Comments
 (0)