competitive

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

View the Project on GitHub mackerel38/competitive

:warning: math/isqrt.hpp

Code

#pragma once
#include <bits/stdc++.h>
using namespace std;

// floor(sqrt(n)) を返す
long long isqrt(long long n) {
    assert(0 <= n);
    long long re = sqrt(n);
    while ((re + 1) * (re + 1) <= n) re++;
    while (n < re * re) re--;
    return re;
}
#line 2 "math/isqrt.hpp"
#include <bits/stdc++.h>
using namespace std;

// floor(sqrt(n)) を返す
long long isqrt(long long n) {
    assert(0 <= n);
    long long re = sqrt(n);
    while ((re + 1) * (re + 1) <= n) re++;
    while (n < re * re) re--;
    return re;
}
Back to top page