Kyopro Library
読み取り中…
検索中…
一致する文字列を見つけられません
kth_root.hpp
[詳解]
1
#
include
"../../kyopro_library/template.hpp"
2
#
include
"../../kyopro_library/algorithm/binary_search.hpp"
3
4
/// @brief n の k 乗根の切り捨てを返す
5
ll
KthRoot
(ll n, ll k=2) {
6
if
(k==1)
return
n;
7
return
(ll)BinarySearch<ll>(0,4e10,[&](ll x) {
8
lll tmp=1;
9
for
(
int
i=0; i<k; i++) {
10
if
(tmp*x>n)
return
false
;
11
tmp*=x;
12
}
13
return
true
;
14
});
15
}
KthRoot
ll KthRoot(ll n, ll k=2)
n の k 乗根の切り捨てを返す
Definition
kth_root.hpp:5
others
kth_root.hpp
構築:
1.13.2