From e5676ef4ad6652ea794aac5d10ce8b65b20e9351 Mon Sep 17 00:00:00 2001 From: Lucas Schwebler Date: Wed, 15 Nov 2023 17:19:47 +0100 Subject: add shortModInv and /usr/bin/time -v --- math/shortModInv.cpp | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 math/shortModInv.cpp (limited to 'math/shortModInv.cpp') diff --git a/math/shortModInv.cpp b/math/shortModInv.cpp new file mode 100644 index 0000000..747eb7a --- /dev/null +++ b/math/shortModInv.cpp @@ -0,0 +1,3 @@ +ll inv(ll a, ll b){ // a^{-1} mod b + return 1 < a ? b - inv(b % a, a) * b / a : 1; +} \ No newline at end of file -- cgit v1.2.3