From 24f0c12468a2d66dcae1a3204d949b195daffb38 Mon Sep 17 00:00:00 2001 From: MZuenni Date: Wed, 1 Mar 2023 12:50:38 +0100 Subject: added digit separator --- graph/matching.cpp | 2 +- java/java.tex | 4 ++-- latexHeaders/code.sty | 4 +++- math/berlekampMassey.cpp | 2 +- math/bigint.cpp | 2 +- math/binomial2.cpp | 2 +- math/linearRecurence.cpp | 2 +- math/linearSieve.cpp | 2 +- math/primeSieve.cpp | 2 +- math/squfof.cpp | 2 +- other/compiletime.cpp | 2 +- other/stuff.cpp | 4 ++-- string/rollingHash.cpp | 6 +++--- string/rollingHashCf.cpp | 4 ++-- tcr.pdf | Bin 646076 -> 645946 bytes 15 files changed, 21 insertions(+), 19 deletions(-) diff --git a/graph/matching.cpp b/graph/matching.cpp index ed9ba62..ddd1c81 100644 --- a/graph/matching.cpp +++ b/graph/matching.cpp @@ -1,4 +1,4 @@ -constexpr int MOD=1000000007, I=10; +constexpr int MOD=1'000'000'007, I=10; vector> adjlist, mat; int gauss(int n, ll p) { diff --git a/java/java.tex b/java/java.tex index af8a024..822de74 100644 --- a/java/java.tex +++ b/java/java.tex @@ -1,3 +1,4 @@ +\begingroup \section{Java} \lstset{language=Java} @@ -33,5 +34,4 @@ \subsection{BigInteger} \lstinputlisting{java/bigInteger.java} } - -\lstset{language=C++} +\endgroup diff --git a/latexHeaders/code.sty b/latexHeaders/code.sty index 535a380..67a6f15 100644 --- a/latexHeaders/code.sty +++ b/latexHeaders/code.sty @@ -22,7 +22,7 @@ \usepackage{listings} \lstset{ - language={C++}, + language={[11]C++}, numbers=left, stepnumber=1, numbersep=6pt, @@ -44,6 +44,7 @@ frame=trbl, aboveskip=3pt, belowskip=3pt, + deletestring=[b]{'},%lose char heighlighting but win digit separator escapechar=@ %moredelim=**[is][{\btHL[fill=green!30,draw=red,dashed,thin]}]{@}{@} } @@ -106,3 +107,4 @@ \makeatother \newcommand{\hl}[1]{\btHL[fill=safeOrange,draw=black,thin]{#1}} + diff --git a/math/berlekampMassey.cpp b/math/berlekampMassey.cpp index 734c07e..29e084f 100644 --- a/math/berlekampMassey.cpp +++ b/math/berlekampMassey.cpp @@ -1,4 +1,4 @@ -constexpr ll mod = 1000000007; +constexpr ll mod = 1'000'000'007; vector BerlekampMassey(const vector& s) { int n = sz(s), L = 0, m = 0; vector C(n), B(n), T; diff --git a/math/bigint.cpp b/math/bigint.cpp index df28a73..6f83a93 100644 --- a/math/bigint.cpp +++ b/math/bigint.cpp @@ -1,5 +1,5 @@ // base and base_digits must be consistent -constexpr ll base = 1000000; +constexpr ll base = 1'000'000; constexpr ll base_digits = 6; struct bigint { vll a; ll sign; diff --git a/math/binomial2.cpp b/math/binomial2.cpp index 2ddcfe9..4531505 100644 --- a/math/binomial2.cpp +++ b/math/binomial2.cpp @@ -1,4 +1,4 @@ -constexpr ll mod = 1000000009; +constexpr ll mod = 1'000'000'009; ll binomPPow(ll n, ll k, ll p) { ll res = 1; diff --git a/math/linearRecurence.cpp b/math/linearRecurence.cpp index 3e1f812..2501e64 100644 --- a/math/linearRecurence.cpp +++ b/math/linearRecurence.cpp @@ -1,4 +1,4 @@ -constexpr ll mod = 1000000007; +constexpr ll mod = 1'000'000'007; vector modMul(const vector& a, const vector& b, const vector& c) { ll n = sz(c); diff --git a/math/linearSieve.cpp b/math/linearSieve.cpp index e1fa7ff..b029b9a 100644 --- a/math/linearSieve.cpp +++ b/math/linearSieve.cpp @@ -1,4 +1,4 @@ -constexpr ll N = 10000000; +constexpr ll N = 10'000'000; ll smallest[N], power[N], sieved[N]; vector primes; diff --git a/math/primeSieve.cpp b/math/primeSieve.cpp index 3898ab7..1b0f514 100644 --- a/math/primeSieve.cpp +++ b/math/primeSieve.cpp @@ -1,4 +1,4 @@ -constexpr ll N = 100000000; +constexpr ll N = 100'000'000; bitset isNotPrime; vector primes = {2}; diff --git a/math/squfof.cpp b/math/squfof.cpp index 78bca73..1cb97de 100644 --- a/math/squfof.cpp +++ b/math/squfof.cpp @@ -64,7 +64,7 @@ lll squfof(lll N) { exit(1);//try fallback to pollard rho } -constexpr lll trialLim = 5000; +constexpr lll trialLim = 5'000; void factor(lll n, map& facts) { for (lll i = 2; i * i <= n && i <= trialLim; i++) { diff --git a/other/compiletime.cpp b/other/compiletime.cpp index 19824e6..b71f83b 100644 --- a/other/compiletime.cpp +++ b/other/compiletime.cpp @@ -4,4 +4,4 @@ struct Table { constexpr Table() : data {} { for (int i = 0; i < N; i++) data[i] = i; }}; -constexpr Table<100000> precalculated; +constexpr Table<100'000> precalculated; diff --git a/other/stuff.cpp b/other/stuff.cpp index e3bbed6..36e60ab 100644 --- a/other/stuff.cpp +++ b/other/stuff.cpp @@ -24,6 +24,6 @@ __int128, __float128 std::decimal::decimal128 // 1e18 < INF < Max_Value / 2 -constexpr long long INF = 0x3FFF_FFFF_FFFF_FFFFll; +constexpr long long INF = 0x3FFF'FFFF'FFFF'FFFFll; // 1e9 < INF < Max_Value / 2 -constexpr int INF = 0x3FFF_FFFF; +constexpr int INF = 0x3FFF'FFFF; diff --git a/string/rollingHash.cpp b/string/rollingHash.cpp index cd88951..00e2273 100644 --- a/string/rollingHash.cpp +++ b/string/rollingHash.cpp @@ -1,6 +1,6 @@ -// q = 29, 101, 257, 65537, 100003, 1000033 (or random) -// m = 1500000001, 1600000009, 1700000009 -// always compare hash and length of hashed range! +// q = 29, 53, 101, 257, 1009, 65'537 +// or choose q random from [sigma, m) +// m = 1'500'000'001, 1'600'000'009, 1'700'000'009 template struct Hasher { vector power = {1}, pref = {0}; diff --git a/string/rollingHashCf.cpp b/string/rollingHashCf.cpp index 9608aff..b055b29 100644 --- a/string/rollingHashCf.cpp +++ b/string/rollingHashCf.cpp @@ -1,6 +1,6 @@ -// q = 29, 53, 101, 257, 1009, 65537 +// q = 29, 53, 101, 257, 1009, 65'537 // or choose q random from [sigma, m) -// m = 1500000001, 1600000009, 1700000009 +// m = 1'500'000'001, 1'600'000'009, 1'700'000'009 struct Hasher { vector power = {1}, pref = {0}; ll m, q; char c; diff --git a/tcr.pdf b/tcr.pdf index 2a4966e..e6b20a7 100644 Binary files a/tcr.pdf and b/tcr.pdf differ -- cgit v1.2.3