library

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

View the Project on GitHub matumoto1234/library

:warning: math/logarithm.hpp

Depends on

Code

#pragma once

#include "./base.hpp"

#include <cassert>

namespace matumoto {
  constexpr int logarithm(ll base, ll n) {
    assert(base != 0);
    int cnt = 0;
    while (n % base == 0) {
      n /= base;
      cnt++;
    }
    return cnt;
  }
} // namespace matumoto
#line 2 "math/logarithm.hpp"

#line 2 "math/base.hpp"

namespace matumoto {
  using namespace std;
  using ll = long long;
} // namespace matumoto
#line 4 "math/logarithm.hpp"

#include <cassert>

namespace matumoto {
  constexpr int logarithm(ll base, ll n) {
    assert(base != 0);
    int cnt = 0;
    while (n % base == 0) {
      n /= base;
      cnt++;
    }
    return cnt;
  }
} // namespace matumoto
Back to top page