diff options
Diffstat (limited to 'math/permIndex.cpp')
| -rw-r--r-- | math/permIndex.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/math/permIndex.cpp b/math/permIndex.cpp index 09ff7f7..4cffc12 100644 --- a/math/permIndex.cpp +++ b/math/permIndex.cpp @@ -6,9 +6,8 @@ ll permIndex(vector<ll> v) { x = t.order_of_key(x); } ll res = 0; - for (ll i = sz(v); i > 0; i--) { - res *= i; - res += v[i - 1]; + for (int i = sz(v); i > 0; i--) { + res = res * i + v[i - 1]; } return res; } |
