cp_library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub downerkei/cp_library

:heavy_check_mark: math/sqrt_floor.hpp

Verified with

Code

long long sqrt_floor(long long N) {
    assert(0 <= N);
    unsigned long long root = sqrtl(N);
    while(root * root > N) root--;
    while((root + 1) * (root + 1) <= N) root++;
    return root;
}
#line 1 "math/sqrt_floor.hpp"
long long sqrt_floor(long long N) {
    assert(0 <= N);
    unsigned long long root = sqrtl(N);
    while(root * root > N) root--;
    while((root + 1) * (root + 1) <= N) root++;
    return root;
}
Back to top page