パッケージ library.core
クラス Utility
java.lang.Object
library.core.Utility
- 直系の既知のサブクラス:
VvyLw
便利なメソッド集
Pairクラス以外の外部クラス不使用
-
コンストラクタの概要
コンストラクタ -
メソッドの概要
修飾子とタイプメソッド説明protected static final doubleave(double... a) 与えられたタプルの平均値を求めるprotected static final doubleave(int... a) 与えられたタプルの平均値を求めるprotected static final doubleave(long... a) 与えられたタプルの平均値を求めるstatic final booleanbinarySearch(int[] a, int x) C++のstd::binarySearchに相当するメソッドstatic final booleanbinarySearch(long[] a, long x) C++のstd::binarySearchに相当するメソッドstatic final <T extends Comparable<? super T>>
booleanbinarySearch(List<T> a, T x) C++のstd::binarySearchに相当するメソッド 遅いstatic final <T extends Comparable<? super T>>
booleanbinarySearch(T[] a, T x) C++のstd::binarySearchに相当するメソッドprotected static final longbinom(int n, int r) nCrを求めるprotected static final longbinom(int n, int r, long mod) modを法とするnCrを求めるprotected static final doublebins(double ok, double ng, DoublePredicate fn) めぐる式二分探索protected static final intbins(int ok, int ng, IntPredicate fn) めぐる式二分探索protected static final longbins(long ok, long ng, LongPredicate fn) めぐる式二分探索protected static final Double[]boxed(double[] a) double型配列をボクシングしてDoubleクラスの配列に変換するprotected static final Integer[]boxed(int[] a) int型配列をボクシングしてIntegerクラスの配列に変換するprotected static final Long[]boxed(long[] a) long型配列をボクシングしてLongクラスの配列に変換するprotected static final doubleclamp(double l, double x, double r) C++のstd::clampのようなメソッドprotected static final intclamp(int l, int x, int r) C++のstd::clampのようなメソッドprotected static final longclamp(long l, long x, long r) C++のstd::clampのようなメソッドprotected static final int[]corPress(int[] a) 座標圧縮protected static final int[]corPress(long[] a) 座標圧縮counter(int[] a) 配列内の数値を個数を数え上げるcounter(long[] a) 配列内の数値を個数を数え上げるprotected static final longcub(long x) 立方数を求めるprotected static final long[]div(long n) nの約数を列挙protected static final longeulerPhi(long n) オイラーのΦ関数protected static final longfact(int n) n!protected static final longfact(int n, long mod) modを法としたn!protected static final intfind(char[] s, char c) 配列sの中にcがあれば何番目にあるか 存在しない場合, -1を返すprotected static final intfind(double[] a, double x) 配列aの中にxがあれば何番目にあるか 存在しない場合, -1を返すprotected static final intfind(int[] a, int x) 配列aの中にxがあれば何番目にあるか 存在しない場合, -1を返すprotected static final intfind(long[] a, long x) 配列aの中にxがあれば何番目にあるか 存在しない場合, -1を返すprotected static final int配列aの中にxがあれば何番目にあるか 存在しない場合, -1を返すprotected static final intfindRev(char[] s, char c) 配列sの中にcがあれば後ろから何番目にあるか 存在しない場合, -1を返すprotected static final intfindRev(double[] a, double x) 配列aの中にxがあれば後ろから何番目にあるか 存在しない場合, -1を返すprotected static final intfindRev(int[] a, int x) 配列aの中にxがあれば後ろから何番目にあるか 存在しない場合, -1を返すprotected static final intfindRev(long[] a, long x) 配列aの中にxがあれば後ろから何番目にあるか 存在しない場合, -1を返すprotected static final int配列aの中にxがあれば後ろから何番目にあるか 存在しない場合, -1を返すprotected static final double[]FloatPairの配列に対して各要素のfirstのみの配列を返すprotected static final long[]IntPairの配列に対して各要素のfirstのみの配列を返すprotected static final <F extends Comparable<? super F>,S extends Comparable<? super S>>
F[]Pairの配列に対して各要素のfirstのみの配列を返すprotected static final longfloorSum(long n, long m, long a, long b) ∑_{i=0}^{n−1} floor((a*i+b)/m)を求めるstatic final intgcd(int... a) 与えられたタプルの最大公約数を求める e.g.) gcd(12, 15, 24) = 3static final longgcd(long... a) 与えられたタプルの最大公約数を求めるstatic final longgcd(long a, long b) aとbの最大公約数を求めるprotected static final doubleC++のstd::inner_productに相当するメソッドprotected static final longC++のstd::inner_productに相当するメソッドprotected static final FloatPairintersection(FloatPair a, double sec1, FloatPair b, double sec2) 直線a.first * x + a.second * y + sec1 = 0と直線b.first * x + b.second * y + sec2 = 0の交点を求める 連立一次方程式を解くのにも使えるprotected static final FloatPairintersection(IntPair a, long sec1, IntPair b, long sec2) 直線a.first * x + a.second * y + sec1 = 0と直線b.first * x + b.second * y + sec2 = 0の交点を求める 連立一次方程式を解くのにも使えるprotected static final doubleintRound(double a, long b, int c) a / bを小数点c桁で四捨五入して求めるprotected static final longinv(long a, long m) inv a(mod m)を求めるstatic final IntStreamiota(int n) C++のstd::iotaに相当するメソッド IntStreamを返すため、配列化するにはtoArray()する必要があるstatic final IntStreamiota(int n, int init) C++のstd::iotaに相当するメソッド IntStreamを返すため、配列化するにはtoArray()する必要があるprotected static final booleanisBit(long i, long j) bit全探索などで使う(i >> jが奇数かどうか)protected static final booleanisInt(double n) nが整数かどうか判定protected static final booleanisPrime(long n) nが素数かどうか判定protected static final booleanisSorted(char[] a) C++のstd::is_sortedに相当するメソッドprotected static final booleanisSorted(double[] a) C++のstd::is_sortedに相当するメソッドprotected static final booleanisSorted(int[] a) C++のstd::is_sortedに相当するメソッドprotected static final booleanisSorted(long[] a) C++のstd::is_sortedに相当するメソッドprotected static final booleanC++のstd::is_sortedに相当するメソッドprotected static final <T extends Comparable<? super T>>
booleanisSorted(T[] a) C++のstd::is_sortedに相当するメソッドprotected static final booleanisSqr(long n) nが平方数かどうか判定static final longkthRoot(long n, int k) nのk乗根を求めるstatic final longlcm(int... a) 与えられたタプルの最小公倍数を求める e.g.) lcm(2, 3, 5) = 30static final longlcm(long... a) 与えられたタプルの最小公倍数を求めるstatic final longlcm(long a, long b) aとbの最小公倍数を求めるstatic final doublelog(double x, long base) baseを底とするxの定数を求めるstatic final intlowerBound(int[] a, int x) C++のstd::lower_boundに相当するメソッドstatic final intlowerBound(long[] a, long x) C++のstd::lower_boundに相当するメソッドstatic final <T extends Comparable<? super T>>
intlowerBound(List<T> a, T x) C++のstd::lower_boundに相当するメソッド 遅いstatic final <T extends Comparable<? super T>>
intlowerBound(T[] a, T x) C++のstd::lower_boundに相当するメソッドprotected static final int[]Manacher Algorithmstatic final doublemax(double... a) 与えられたタプルの最大値を求めるstatic final intmax(int... a) 与えられたタプルの最大値を求めるstatic final longmax(long... a) 与えられたタプルの最大値を求めるprotected static final doublemedian(double[] a) ソート済配列の中央値を求めるprotected static final doublemedian(int[] a) ソート済配列の中央値を求めるprotected static final doublemedian(long[] a) ソート済配列の中央値を求めるstatic final doublemin(double... a) 与えられたタプルの最小値を求めるstatic final intmin(int... a) 与えられたタプルの最小値を求めるstatic final longmin(long... a) 与えられたタプルの最小値を求めるprotected static final intmod(long n, int m) nが負の時でも正の剰余を求める 法がintの時, intで返すstatic final longmod(long n, long m) nが負の時でも正の剰余を求めるprotected static final longmodPow(long a, long b, long m) aのb乗(mod m)を求めるprotected static final booleannextPerm(char[] a) C++のstd::next_permutationに相当するメソッドprotected static final booleannextPerm(double[] a) C++のstd::next_permutationに相当するメソッドprotected static final booleannextPerm(int[] a) C++のstd::next_permutationに相当するメソッドprotected static final booleannextPerm(long[] a) C++のstd::next_permutationに相当するメソッドprotected static final Stringno(boolean ok) protected static final longperm(int n, int r) nPrを求めるprotected static final longperm(int n, int r, long mod) modを法としたnPrを求めるprotected static final longpowi(long a, int b) aのb乗を求めるprotected static final booleanprevPerm(char[] a) C++のstd::prev_permutationに相当するメソッドprotected static final booleanprevPerm(double[] a) C++のstd::prev_permutationに相当するメソッドprotected static final booleanprevPerm(int[] a) C++のstd::prev_permutationに相当するメソッドprotected static final booleanprevPerm(long[] a) C++のstd::prev_permutationに相当するメソッドprotected static final IntPair[]primeFactor(long n) nを素因数分解 e.g.) primeFactor(24) = [(2, 3), (3, 1)]protected static final doubleprod(double... a) 与えられたタプルの総積を求めるprotected static final longprod(int... a) 与えられたタプルの総積を求めるprotected static final longprod(long... a) 与えられたタプルの総積を求めるprotected static final char[]reverse(char[] a) 配列を逆順に並び替えるprotected static final double[]reverse(double[] a) 配列を逆順に並び替えるprotected static final int[]reverse(int[] a) 配列を逆順に並び替えるprotected static final long[]reverse(long[] a) 配列を逆順に並び替えるprotected static final Object[]配列を逆順に並び替えるprotected static final String文字列を逆順に並び替えるstatic final boolean[]rotate(boolean[] a, int id) C++のstd::rotateに相当するメソッドstatic final char[]rotate(char[] a, int id) C++のstd::rotateに相当するメソッドstatic final double[]rotate(double[] a, int id) C++のstd::rotateに相当するメソッドstatic final int[]rotate(int[] a, int id) C++のstd::rotateに相当するメソッドstatic final long[]rotate(long[] a, int id) C++のstd::rotateに相当するメソッドstatic final Object[]C++のstd::rotateに相当するメソッドstatic final StringC++のstd::rotateに相当するメソッドprotected static final char[][]rotateL(char[][] a) 二次元配列を左回転させるprotected static final double[][]rotateL(double[][] a) 二次元配列を左回転させるprotected static final int[][]rotateL(int[][] a) 二次元配列を左回転させるprotected static final long[][]rotateL(long[][] a) 二次元配列を左回転させるprotected static final char[][]rotateR(char[][] a) 二次元配列を右回転させるprotected static final double[][]rotateR(double[][] a) 二次元配列を右回転させるprotected static final int[][]rotateR(int[][] a) 二次元配列を右回転させるprotected static final long[][]rotateR(long[][] a) 二次元配列を右回転させるprotected static final IntPair[]runLenPress(int[] a) ランレングス圧縮protected static final IntPair[]runLenPress(long[] a) ランレングス圧縮ランレングス圧縮protected static final long[]ランレングス圧縮したint型配列の復元protected static final Stringランレングス圧縮した文字列の復元static final booleanscope(double l, double x, double r) xが閉区間[l, r]の中に収まるか判定するstatic final booleanscope(int l, int x, int r) xが閉区間[l, r]の中に収まるか判定するstatic final booleanscope(long l, long x, long r) xが閉区間[l, r]の中に収まるか判定するprotected static final double[]FloatPairの配列に対して各要素のsecondのみの配列を返すprotected static final long[]IntPairの配列に対して各要素のsecondのみの配列を返すprotected static final <F extends Comparable<? super F>,S extends Comparable<? super S>>
S[]Pairの配列に対して各要素のsecondのみの配列を返すprotected static final longsigma(long n) 1からnまでの総和を求めるprotected static final longsigma(long a, long b) aからbまでの総和を求めるstatic final char[]sorted(char[] a) Pythonのsortedに相当するメソッドstatic final double[]sorted(double[] a) Pythonのsortedに相当するメソッドstatic final int[]sorted(int[] a) Pythonのsortedに相当するメソッドstatic final long[]sorted(long[] a) Pythonのsortedに相当するメソッドstatic final StringPythonのsortedに相当するメソッドstatic final <T extends Comparable<? super T>>
T[]sorted(T[] a) Pythonのsortedに相当するメソッドprotected static final longsqr(long x) 平方数を求めるstatic final doublesum(double... a) 与えられたタプルの総和を求めるstatic final longsum(int... a) 与えられたタプルの総和を求めるstatic final longsum(long... a) 与えられたタプルの総和を求めるstatic final voidswap(boolean[] a, boolean[] b) 二つの配列を入れ替えるstatic final voidswap(boolean[] a, int i, int j) 配列のi番目とj番目を入れ替えるstatic final voidswap(char[] a, char[] b) 二つの配列を入れ替えるstatic final voidswap(char[] a, int i, int j) 配列のi番目とj番目を入れ替えるstatic final voidswap(double[] a, double[] b) 二つの配列を入れ替えるstatic final voidswap(double[] a, int i, int j) 配列のi番目とj番目を入れ替えるstatic final voidswap(int[] a, int[] b) 二つの配列を入れ替えるstatic final voidswap(int[] a, int i, int j) 配列のi番目とj番目を入れ替えるstatic final voidswap(long[] a, int i, int j) 配列のi番目とj番目を入れ替えるstatic final voidswap(long[] a, long[] b) 二つの配列を入れ替えるstatic final void配列のi番目とj番目を入れ替えるstatic final void二つの配列を入れ替えるstatic final FloatPair[]FloatPairの配列に対して各要素をswapさせるstatic final IntPair[]IntPairの配列に対して各要素をswapさせるstatic final <F extends Comparable<? super F>,S extends Comparable<? super S>>
Pair<S,F>[] Pairの配列に対して各要素をswapさせるprotected static final longtetration(long a, long b, long m) a↑↑bはa^a^a^...static final intupperBound(int[] a, int x) C++のstd::upper_boundに相当するメソッドstatic final intupperBound(long[] a, long x) C++のstd::upper_boundに相当するメソッドstatic final <T extends Comparable<? super T>>
intupperBound(List<T> a, T x) C++のstd::upper_boundに相当するメソッド 遅いstatic final <T extends Comparable<? super T>>
intupperBound(T[] a, T x) C++のstd::upper_boundに相当するメソッドprotected static final Stringyes(boolean ok) 古のYESNOパターンやyesnoパターンの時はString.toUpperCase(java.util.Locale)やString.toLowerCase(java.util.Locale)を使うと良いprotected static final int[]zAlgorithm(String s) Z-Algorithm
-
コンストラクタの詳細
-
Utility
public Utility()
-
-
メソッドの詳細
-
yes
古のYESNOパターンやyesnoパターンの時はString.toUpperCase(java.util.Locale)やString.toLowerCase(java.util.Locale)を使うと良い- パラメータ:
ok- boolean- 戻り値:
- okがtrueなら"Yes" falseなら"No"
-
no
- パラメータ:
ok- boolean- 戻り値:
- okがtrueなら"No" falseなら"Yes"
-
sqr
protected static final long sqr(long x) 平方数を求める- パラメータ:
x-- 戻り値:
- xの平方数
-
cub
protected static final long cub(long x) 立方数を求める- パラメータ:
x-- 戻り値:
- xの立方数
-
mod
protected static final int mod(long n, int m) nが負の時でも正の剰余を求める 法がintの時, intで返す- パラメータ:
n-m-
-
mod
public static final long mod(long n, long m) nが負の時でも正の剰余を求める- パラメータ:
n-m-
-
log
public static final double log(double x, long base) baseを底とするxの定数を求める- パラメータ:
x-base-- 戻り値:
- baseを底とするxの対数
-
intRound
protected static final double intRound(double a, long b, int c) a / bを小数点c桁で四捨五入して求める- パラメータ:
a-b-c-
-
powi
protected static final long powi(long a, int b) aのb乗を求める- パラメータ:
a-b-- 戻り値:
- aのb乗
-
modPow
protected static final long modPow(long a, long b, long m) aのb乗(mod m)を求める- パラメータ:
a-b-m-- 戻り値:
- aのb乗のmを法とした剰余
-
inv
protected static final long inv(long a, long m) inv a(mod m)を求める- パラメータ:
a-m-- 戻り値:
- aの逆元のmを法とした剰余
-
lcm
public static final long lcm(long a, long b) aとbの最小公倍数を求める- パラメータ:
a-b-- 戻り値:
- aとbの最小公倍数
-
lcm
public static final long lcm(int... a) 与えられたタプルの最小公倍数を求める e.g.) lcm(2, 3, 5) = 30- パラメータ:
a- int型タプル あるいはint型配列- 戻り値:
- aの最小公倍数
-
lcm
public static final long lcm(long... a) 与えられたタプルの最小公倍数を求める- パラメータ:
a- long型タプル あるいはlong型配列- 戻り値:
- aの最小公倍数
-
gcd
public static final long gcd(long a, long b) aとbの最大公約数を求める- パラメータ:
a-b-- 戻り値:
- aとbの最大公約数
-
gcd
public static final int gcd(int... a) 与えられたタプルの最大公約数を求める e.g.) gcd(12, 15, 24) = 3- パラメータ:
a- int型タプル あるいはint型配列- 戻り値:
- aの最大公約数
-
gcd
public static final long gcd(long... a) 与えられたタプルの最大公約数を求める- パラメータ:
a- long型タプル あるいはlong型配列- 戻り値:
- aの最大公約数
-
min
public static final int min(int... a) 与えられたタプルの最小値を求める- パラメータ:
a- int型タプル あるいはint型配列- 戻り値:
- aの最小値
-
min
public static final long min(long... a) 与えられたタプルの最小値を求める- パラメータ:
a- long型タプル あるいはlong型配列- 戻り値:
- aの最小値
-
min
public static final double min(double... a) 与えられたタプルの最小値を求める- パラメータ:
a- double型タプル あるいはdouble型配列- 戻り値:
- aの最小値
-
max
public static final int max(int... a) 与えられたタプルの最大値を求める- パラメータ:
a- int型タプル あるいはint型配列- 戻り値:
- aの最大値
-
max
public static final long max(long... a) 与えられたタプルの最大値を求める- パラメータ:
a- long型タプル あるいはlong型配列- 戻り値:
- aの最大値
-
max
public static final double max(double... a) 与えられたタプルの最大値を求める- パラメータ:
a- double型タプル あるいはdouble型配列- 戻り値:
- aの最大値
-
sum
public static final long sum(int... a) 与えられたタプルの総和を求める- パラメータ:
a- int型タプル あるいはint型配列- 戻り値:
- aの総和
-
sum
public static final long sum(long... a) 与えられたタプルの総和を求める- パラメータ:
a- long型タプル あるいはlong型配列- 戻り値:
- aの総和
-
sum
public static final double sum(double... a) 与えられたタプルの総和を求める- パラメータ:
a- double型タプル あるいはdouble型配列- 戻り値:
- aの総和
-
prod
protected static final long prod(int... a) 与えられたタプルの総積を求める- パラメータ:
a- int型タプル あるいはint型配列- 戻り値:
- aの総積
-
prod
protected static final long prod(long... a) 与えられたタプルの総積を求める- パラメータ:
a- long型タプル あるいはlong型配列- 戻り値:
- aの総積
-
prod
protected static final double prod(double... a) 与えられたタプルの総積を求める- パラメータ:
a- double型タプル あるいはdouble型配列- 戻り値:
- aの総積
-
ave
protected static final double ave(int... a) 与えられたタプルの平均値を求める- パラメータ:
a- int型タプル あるいはint型配列- 戻り値:
- aの平均値
-
ave
protected static final double ave(long... a) 与えられたタプルの平均値を求める- パラメータ:
a- long型タプル あるいはlong型配列- 戻り値:
- aの平均値
-
ave
protected static final double ave(double... a) 与えられたタプルの平均値を求める- パラメータ:
a- double型タプル あるいはdouble型配列- 戻り値:
- aの平均値
-
median
protected static final double median(int[] a) ソート済配列の中央値を求める- パラメータ:
a- ソート済のint型配列- 戻り値:
- 中央値
-
median
protected static final double median(long[] a) ソート済配列の中央値を求める- パラメータ:
a- ソート済のlong型配列- 戻り値:
- 中央値
-
median
protected static final double median(double[] a) ソート済配列の中央値を求める- パラメータ:
a- ソート済のdouble型配列- 戻り値:
- 中央値
-
div
protected static final long[] div(long n) nの約数を列挙- パラメータ:
n- 整数- 戻り値:
- nの約数の配列
-
primeFactor
nを素因数分解 e.g.) primeFactor(24) = [(2, 3), (3, 1)]- パラメータ:
n- 整数- 戻り値:
- nの素因数分解結果
-
eulerPhi
protected static final long eulerPhi(long n) オイラーのΦ関数- パラメータ:
n- 整数- 戻り値:
- 1からnまでの整数のうちnと互いに素なものの個数
-
sigma
protected static final long sigma(long n) 1からnまでの総和を求める- パラメータ:
n-- 戻り値:
- 1からnまでの総和
-
sigma
protected static final long sigma(long a, long b) aからbまでの総和を求める- パラメータ:
a-b-- 戻り値:
- aからbまでの総和
-
fact
protected static final long fact(int n) n!を求める- パラメータ:
n- 整数- 戻り値:
- nの階乗
-
fact
protected static final long fact(int n, long mod) modを法としたn!を求める- パラメータ:
n-mod-- 戻り値:
- nの階乗のmodを法とする剰余
-
perm
protected static final long perm(int n, int r) nPrを求める- パラメータ:
n-r-- 戻り値:
- 順列(nPr)
-
perm
protected static final long perm(int n, int r, long mod) modを法としたnPrを求める- パラメータ:
n-r-mod-- 戻り値:
- 順列のmodを法とする剰余
-
binom
protected static final long binom(int n, int r) nCrを求める- パラメータ:
n-r-- 戻り値:
- 二項係数(nCr)
-
binom
protected static final long binom(int n, int r, long mod) modを法とするnCrを求める- パラメータ:
n-r-mod-- 戻り値:
- 二項係数のmodを法とする剰余
-
isInt
protected static final boolean isInt(double n) nが整数かどうか判定- パラメータ:
n-- 戻り値:
- nが整数ならtrue, 整数でないならfalse
-
isSqr
protected static final boolean isSqr(long n) nが平方数かどうか判定- パラメータ:
n-- 戻り値:
- nが平方数ならtrue, 平方数でないならfalse
-
isPrime
protected static final boolean isPrime(long n) nが素数かどうか判定- パラメータ:
n-- 戻り値:
- nが素数ならtrue, 1か合成数ならfalse
-
scope
public static final boolean scope(int l, int x, int r) xが閉区間[l, r]の中に収まるか判定する- パラメータ:
l-x-r-- 戻り値:
- l 入力が無効です: '<'= x 入力が無効です: '<'= r
-
scope
public static final boolean scope(long l, long x, long r) xが閉区間[l, r]の中に収まるか判定する- パラメータ:
l-x-r-- 戻り値:
- l 入力が無効です: '<'= x 入力が無効です: '<'= r
-
scope
public static final boolean scope(double l, double x, double r) xが閉区間[l, r]の中に収まるか判定する- パラメータ:
l-x-r-- 戻り値:
- l 入力が無効です: '<'= x 入力が無効です: '<'= r
-
clamp
protected static final int clamp(int l, int x, int r) C++のstd::clampのようなメソッド- パラメータ:
l-x-r-- 関連項目:
-
clamp
protected static final long clamp(long l, long x, long r) C++のstd::clampのようなメソッド- パラメータ:
l-x-r-- 関連項目:
-
clamp
protected static final double clamp(double l, double x, double r) C++のstd::clampのようなメソッド- パラメータ:
l-x-r-- 関連項目:
-
isBit
protected static final boolean isBit(long i, long j) bit全探索などで使う(i >> jが奇数かどうか)- パラメータ:
i- bitj- target
-
nextPerm
protected static final boolean nextPerm(int[] a) C++のstd::next_permutationに相当するメソッド- パラメータ:
a-- 関連項目:
-
nextPerm
protected static final boolean nextPerm(long[] a) C++のstd::next_permutationに相当するメソッド- パラメータ:
a-- 関連項目:
-
nextPerm
protected static final boolean nextPerm(double[] a) C++のstd::next_permutationに相当するメソッド- パラメータ:
a-- 関連項目:
-
nextPerm
protected static final boolean nextPerm(char[] a) C++のstd::next_permutationに相当するメソッド- パラメータ:
a-- 関連項目:
-
prevPerm
protected static final boolean prevPerm(int[] a) C++のstd::prev_permutationに相当するメソッド- パラメータ:
a-- 関連項目:
-
prevPerm
protected static final boolean prevPerm(long[] a) C++のstd::prev_permutationに相当するメソッド- パラメータ:
a-- 関連項目:
-
prevPerm
protected static final boolean prevPerm(double[] a) C++のstd::prev_permutationに相当するメソッド- パラメータ:
a-- 関連項目:
-
prevPerm
protected static final boolean prevPerm(char[] a) C++のstd::prev_permutationに相当するメソッド- パラメータ:
a-- 関連項目:
-
find
protected static final int find(int[] a, int x) 配列aの中にxがあれば何番目にあるか 存在しない場合, -1を返す- パラメータ:
a-x-- 関連項目:
-
find
protected static final int find(long[] a, long x) 配列aの中にxがあれば何番目にあるか 存在しない場合, -1を返す- パラメータ:
a-x-- 関連項目:
-
find
protected static final int find(double[] a, double x) 配列aの中にxがあれば何番目にあるか 存在しない場合, -1を返す- パラメータ:
a-x-- 関連項目:
-
find
protected static final int find(char[] s, char c) 配列sの中にcがあれば何番目にあるか 存在しない場合, -1を返す- パラメータ:
s-c-- 関連項目:
-
find
配列aの中にxがあれば何番目にあるか 存在しない場合, -1を返す- パラメータ:
a-x-- 関連項目:
-
findRev
protected static final int findRev(int[] a, int x) 配列aの中にxがあれば後ろから何番目にあるか 存在しない場合, -1を返す- パラメータ:
a-x-
-
findRev
protected static final int findRev(long[] a, long x) 配列aの中にxがあれば後ろから何番目にあるか 存在しない場合, -1を返す- パラメータ:
a-x-
-
findRev
protected static final int findRev(double[] a, double x) 配列aの中にxがあれば後ろから何番目にあるか 存在しない場合, -1を返す- パラメータ:
a-x-
-
findRev
protected static final int findRev(char[] s, char c) 配列sの中にcがあれば後ろから何番目にあるか 存在しない場合, -1を返す- パラメータ:
s-c-
-
findRev
配列aの中にxがあれば後ろから何番目にあるか 存在しない場合, -1を返す- パラメータ:
a-x-
-
binarySearch
public static final boolean binarySearch(int[] a, int x) C++のstd::binarySearchに相当するメソッド- パラメータ:
a-x-- 戻り値:
- ソート済配列の中に要素が含まれていればtrue
- 関連項目:
-
binarySearch
public static final boolean binarySearch(long[] a, long x) C++のstd::binarySearchに相当するメソッド- パラメータ:
a-x-- 戻り値:
- ソート済配列の中に要素が含まれていればtrue
- 関連項目:
-
binarySearch
C++のstd::binarySearchに相当するメソッド- 型パラメータ:
T-- パラメータ:
a-x-- 戻り値:
- ソート済配列の中に要素が含まれていればtrue
- 関連項目:
-
binarySearch
C++のstd::binarySearchに相当するメソッド 遅い- 型パラメータ:
T-- パラメータ:
a-x-- 戻り値:
- ソート済リストの中に要素が含まれていればtrue
- 関連項目:
-
lowerBound
public static final int lowerBound(int[] a, int x) C++のstd::lower_boundに相当するメソッド- パラメータ:
a-x-- 戻り値:
- その値以上の要素が初めて現れるインデックス(イテレータではない)
- 関連項目:
-
lowerBound
public static final int lowerBound(long[] a, long x) C++のstd::lower_boundに相当するメソッド- パラメータ:
a-x-- 戻り値:
- その値以上の要素が初めて現れるインデックス(イテレータではない)
- 関連項目:
-
lowerBound
C++のstd::lower_boundに相当するメソッド- 型パラメータ:
T-- パラメータ:
a-x-- 戻り値:
- その値以上の要素が初めて現れるインデックス(イテレータではない)
- 関連項目:
-
lowerBound
C++のstd::lower_boundに相当するメソッド 遅い- 型パラメータ:
T-- パラメータ:
a-x-- 戻り値:
- その値以上の要素が初めて現れるインデックス(イテレータではない)
- 関連項目:
-
upperBound
public static final int upperBound(int[] a, int x) C++のstd::upper_boundに相当するメソッド- パラメータ:
a-x-- 戻り値:
- その値より大きい要素が初めて現れるインデックス(イテレータではない)
- 関連項目:
-
upperBound
public static final int upperBound(long[] a, long x) C++のstd::upper_boundに相当するメソッド- パラメータ:
a-x-- 戻り値:
- その値より大きい要素が初めて現れるインデックス(イテレータではない)
- 関連項目:
-
upperBound
C++のstd::upper_boundに相当するメソッド- パラメータ:
a-x-- 戻り値:
- その値より大きい要素が初めて現れるインデックス(イテレータではない)
- 関連項目:
-
upperBound
C++のstd::upper_boundに相当するメソッド 遅い- パラメータ:
a-x-- 戻り値:
- その値より大きい要素が初めて現れるインデックス(イテレータではない)
- 関連項目:
-
sorted
Pythonのsortedに相当するメソッド- パラメータ:
s-- 戻り値:
- 昇順にソートした文字列
-
sorted
public static final int[] sorted(int[] a) Pythonのsortedに相当するメソッド- パラメータ:
a-- 戻り値:
- 昇順にソートしたint型配列
-
sorted
public static final long[] sorted(long[] a) Pythonのsortedに相当するメソッド- パラメータ:
a-- 戻り値:
- 昇順にソートしたlong型配列
-
sorted
public static final double[] sorted(double[] a) Pythonのsortedに相当するメソッド- パラメータ:
a-- 戻り値:
- 昇順にソートしたdouble型配列
-
sorted
public static final char[] sorted(char[] a) Pythonのsortedに相当するメソッド- パラメータ:
a-- 戻り値:
- 昇順にソートしたchar型配列
-
sorted
Pythonのsortedに相当するメソッド- 型パラメータ:
T- Comparableなクラス- パラメータ:
a-- 戻り値:
- 昇順にソートした総称型配列
-
isSorted
C++のstd::is_sortedに相当するメソッド- パラメータ:
s-- 戻り値:
- 文字列がソートされているかどうか
- 関連項目:
-
isSorted
protected static final boolean isSorted(int[] a) C++のstd::is_sortedに相当するメソッド- パラメータ:
a-- 戻り値:
- 配列がソートされているかどうか
- 関連項目:
-
isSorted
protected static final boolean isSorted(long[] a) C++のstd::is_sortedに相当するメソッド- パラメータ:
a-- 戻り値:
- 配列がソートされているかどうか
- 関連項目:
-
isSorted
protected static final boolean isSorted(double[] a) C++のstd::is_sortedに相当するメソッド- パラメータ:
a-- 戻り値:
- 配列がソートされているかどうか
- 関連項目:
-
isSorted
protected static final boolean isSorted(char[] a) C++のstd::is_sortedに相当するメソッド- パラメータ:
a-- 戻り値:
- 配列がソートされているかどうか
- 関連項目:
-
isSorted
C++のstd::is_sortedに相当するメソッド- 型パラメータ:
T-Comparableなクラス- パラメータ:
a-- 戻り値:
- 配列がソートされているかどうか
- 関連項目:
-
reverse
文字列を逆順に並び替える- パラメータ:
s-- 戻り値:
- 逆順に並び替えた文字列
-
reverse
protected static final int[] reverse(int[] a) 配列を逆順に並び替える- パラメータ:
a-- 戻り値:
- 逆順に並び替えたint型配列
-
reverse
protected static final long[] reverse(long[] a) 配列を逆順に並び替える- パラメータ:
a-- 戻り値:
- 逆順に並び替えたlong型配列
-
reverse
protected static final double[] reverse(double[] a) 配列を逆順に並び替える- パラメータ:
a-- 戻り値:
- 逆順に並び替えたdouble型配列
-
reverse
protected static final char[] reverse(char[] a) 配列を逆順に並び替える- パラメータ:
a-- 戻り値:
- 逆順に並び替えたchar型配列
-
reverse
配列を逆順に並び替える- パラメータ:
a-- 戻り値:
- 逆順に並び替えたObjectクラスの配列
-
rotate
public static final int[] rotate(int[] a, int id) C++のstd::rotateに相当するメソッド- パラメータ:
a-id- 正の数の時、前にある値は後ろに移動し、負の数の時、後ろにある値は前に移動する- 関連項目:
-
rotate
public static final long[] rotate(long[] a, int id) C++のstd::rotateに相当するメソッド- パラメータ:
a-id- 正の数の時、前にある値は後ろに移動し、負の数の時、後ろにある値は前に移動する- 関連項目:
-
rotate
public static final double[] rotate(double[] a, int id) C++のstd::rotateに相当するメソッド- パラメータ:
a-id- 正の数の時、前にある値は後ろに移動し、負の数の時、後ろにある値は前に移動する- 関連項目:
-
rotate
public static final char[] rotate(char[] a, int id) C++のstd::rotateに相当するメソッド- パラメータ:
a-id- 正の数の時、前にある値は後ろに移動し、負の数の時、後ろにある値は前に移動する- 関連項目:
-
rotate
public static final boolean[] rotate(boolean[] a, int id) C++のstd::rotateに相当するメソッド- パラメータ:
a-id- 正の数の時、前にある値は後ろに移動し、負の数の時、後ろにある値は前に移動する- 関連項目:
-
rotate
C++のstd::rotateに相当するメソッド- パラメータ:
a-id- 正の数の時、前にある値は後ろに移動し、負の数の時、後ろにある値は前に移動する- 関連項目:
-
rotate
C++のstd::rotateに相当するメソッド- パラメータ:
s-id- 正の数の時、前にある値は後ろに移動し、負の数の時、後ろにある値は前に移動する- 関連項目:
-
rotateR
protected static final int[][] rotateR(int[][] a) 二次元配列を右回転させる- パラメータ:
a-- 戻り値:
- 二次元配列を右回転させたもの
-
rotateR
protected static final long[][] rotateR(long[][] a) 二次元配列を右回転させる- パラメータ:
a-- 戻り値:
- 二次元配列を右回転させたもの
-
rotateR
protected static final double[][] rotateR(double[][] a) 二次元配列を右回転させる- パラメータ:
a-- 戻り値:
- 二次元配列を右回転させたもの
-
rotateR
protected static final char[][] rotateR(char[][] a) 二次元配列を右回転させる- パラメータ:
a-- 戻り値:
- 二次元配列を右回転させたもの
-
rotateL
protected static final int[][] rotateL(int[][] a) 二次元配列を左回転させる- パラメータ:
a-- 戻り値:
- 二次元配列を左回転させたもの
-
rotateL
protected static final long[][] rotateL(long[][] a) 二次元配列を左回転させる- パラメータ:
a-- 戻り値:
- 二次元配列を左回転させたもの
-
rotateL
protected static final double[][] rotateL(double[][] a) 二次元配列を左回転させる- パラメータ:
a-- 戻り値:
- 二次元配列を左回転させたもの
-
rotateL
protected static final char[][] rotateL(char[][] a) 二次元配列を左回転させる- パラメータ:
a-- 戻り値:
- 二次元配列を左回転させたもの
-
swap
public static final void swap(int[] a, int i, int j) 配列のi番目とj番目を入れ替える- パラメータ:
a-i-j-- 関連項目:
-
swap
public static final void swap(long[] a, int i, int j) 配列のi番目とj番目を入れ替える- パラメータ:
a-i-j-- 関連項目:
-
swap
public static final void swap(double[] a, int i, int j) 配列のi番目とj番目を入れ替える- パラメータ:
a-i-j-- 関連項目:
-
swap
public static final void swap(char[] a, int i, int j) 配列のi番目とj番目を入れ替える- パラメータ:
a-i-j-- 関連項目:
-
swap
public static final void swap(boolean[] a, int i, int j) 配列のi番目とj番目を入れ替える- パラメータ:
a-i-j-- 関連項目:
-
swap
配列のi番目とj番目を入れ替える- パラメータ:
a-i-j-- 関連項目:
-
swap
public static final void swap(int[] a, int[] b) 二つの配列を入れ替える- パラメータ:
a-b-- 関連項目:
-
swap
public static final void swap(long[] a, long[] b) 二つの配列を入れ替える- パラメータ:
a-b-- 関連項目:
-
swap
public static final void swap(double[] a, double[] b) 二つの配列を入れ替える- パラメータ:
a-b-- 関連項目:
-
swap
public static final void swap(char[] a, char[] b) 二つの配列を入れ替える- パラメータ:
a-b-- 関連項目:
-
swap
public static final void swap(boolean[] a, boolean[] b) 二つの配列を入れ替える- パラメータ:
a-b-- 関連項目:
-
swap
二つの配列を入れ替える- パラメータ:
a-b-- 関連項目:
-
swap
public static final <F extends Comparable<? super F>,S extends Comparable<? super S>> Pair<S,F>[] swap(Pair<F, S>[] p) Pairの配列に対して各要素をswapさせる- 型パラメータ:
F-S-- パラメータ:
p-- 戻り値:
- Pair配列の各Pairに対して
Pair.swap()をした配列
-
swap
IntPairの配列に対して各要素をswapさせる- パラメータ:
p-- 戻り値:
- IntPair配列の各IntPairに対して
IntPair.swap()をした配列
-
swap
FloatPairの配列に対して各要素をswapさせる- パラメータ:
p-- 戻り値:
- FloatPair配列の各FloatPairに対して
FloatPair.swap()をした配列
-
first
protected static final <F extends Comparable<? super F>,S extends Comparable<? super S>> F[] first(Pair<F, S>[] p) Pairの配列に対して各要素のfirstのみの配列を返す- 型パラメータ:
F-S-- パラメータ:
p-- 戻り値:
- Pairクラスの配列に対してfirstのみの要素を取り出した配列
-
first
IntPairの配列に対して各要素のfirstのみの配列を返す- パラメータ:
p-- 戻り値:
- IntPairクラスの配列に対してfirstのみの要素を取り出した配列
-
first
FloatPairの配列に対して各要素のfirstのみの配列を返す- パラメータ:
p-- 戻り値:
- FloatPairクラスの配列に対してfirstのみの要素を取り出した配列
-
second
protected static final <F extends Comparable<? super F>,S extends Comparable<? super S>> S[] second(Pair<F, S>[] p) Pairの配列に対して各要素のsecondのみの配列を返す- 型パラメータ:
F-S-- パラメータ:
p-- 戻り値:
- Pairクラスの配列に対してsecondのみの要素を取り出した配列
-
second
IntPairの配列に対して各要素のsecondのみの配列を返す- パラメータ:
p-- 戻り値:
- IntPairクラスの配列に対してsecondのみの要素を取り出した配列
-
second
FloatPairの配列に対して各要素のsecondのみの配列を返す- パラメータ:
p-- 戻り値:
- FloatPairクラスの配列に対してsecondのみの要素を取り出した配列
-
iota
C++のstd::iotaに相当するメソッド IntStreamを返すため、配列化するにはtoArray()する必要がある- パラメータ:
n-- 戻り値:
- [0, 1, 2, ..., n - 1]のIntStream
- 関連項目:
-
iota
C++のstd::iotaに相当するメソッド IntStreamを返すため、配列化するにはtoArray()する必要がある- パラメータ:
n-init-- 戻り値:
- [init, init + 1, init + 2, ..., init + n - 1]
- 関連項目:
-
boxed
int型配列をボクシングしてIntegerクラスの配列に変換する- パラメータ:
a-- 戻り値:
- int[] -> Integer[]
-
boxed
long型配列をボクシングしてLongクラスの配列に変換する- パラメータ:
a-- 戻り値:
- long[] -> Long[]
-
boxed
double型配列をボクシングしてDoubleクラスの配列に変換する- パラメータ:
a-- 戻り値:
- double[] -> Double[]
-
bins
めぐる式二分探索- パラメータ:
ok- 答えになる可能性がある臨界値ng- 答えになる可能性がない臨界値fn- 条件- 関連項目:
-
bins
めぐる式二分探索- パラメータ:
ok- 答えになる可能性がある臨界値ng- 答えになる可能性がない臨界値fn- 条件- 関連項目:
-
bins
めぐる式二分探索- パラメータ:
ok- 答えになる可能性がある臨界値ng- 答えになる可能性がない臨界値fn- 条件- 関連項目:
-
counter
配列内の数値を個数を数え上げる- パラメータ:
a-
-
counter
配列内の数値を個数を数え上げる- パラメータ:
a-
-
innerProd
C++のstd::inner_productに相当するメソッド- パラメータ:
p-- 戻り値:
- 内積
- 関連項目:
-
innerProd
C++のstd::inner_productに相当するメソッド- パラメータ:
p-- 戻り値:
- 内積
- 関連項目:
-
intersection
直線a.first * x + a.second * y + sec1 = 0と直線b.first * x + b.second * y + sec2 = 0の交点を求める 連立一次方程式を解くのにも使える- パラメータ:
a-sec1-b-sec2-- 戻り値:
- 直線a.first * x + a.second * y + sec1 = 0と直線b.first * x + b.second * y + sec2 = 0の交点
-
intersection
直線a.first * x + a.second * y + sec1 = 0と直線b.first * x + b.second * y + sec2 = 0の交点を求める 連立一次方程式を解くのにも使える- パラメータ:
a-sec1-b-sec2-- 戻り値:
- 直線a.first * x + a.second * y + sec1 = 0と直線b.first * x + b.second * y + sec2 = 0の交点
-
corPress
protected static final int[] corPress(int[] a) 座標圧縮- パラメータ:
a-
-
corPress
protected static final int[] corPress(long[] a) 座標圧縮- パラメータ:
a-
-
runLenPress
ランレングス圧縮- パラメータ:
a-- 戻り値:
- ランレングス圧縮
-
runLenPress
ランレングス圧縮- パラメータ:
a-- 戻り値:
- ランレングス圧縮
-
runLenPress
ランレングス圧縮- パラメータ:
s-- 戻り値:
- ランレングス圧縮
-
runLenRev
ランレングス圧縮したint型配列の復元- パラメータ:
a-- 戻り値:
- ランレングス圧縮したものを戻す
-
runLenRev
ランレングス圧縮した文字列の復元- パラメータ:
a-- 戻り値:
- ランレングス圧縮したものを戻す
-
zAlgorithm
Z-Algorithm- パラメータ:
s-- 関連項目:
-
manacher
Manacher Algorithm- パラメータ:
s_-calcEven-- 関連項目:
-
kthRoot
public static final long kthRoot(long n, int k) nのk乗根を求める- パラメータ:
n-k-- 戻り値:
- nのk乗根
-
tetration
protected static final long tetration(long a, long b, long m) a↑↑bはa^a^a^...^a(aはb個ある)を表す- パラメータ:
a-b-m-- 戻り値:
- a↑↑b(mod m)
-
floorSum
protected static final long floorSum(long n, long m, long a, long b) ∑_{i=0}^{n−1} floor((a*i+b)/m)を求める- パラメータ:
n-m-a-b-- 関連項目:
-