library

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

View the Project on GitHub matumoto1234/library

:warning: math/binomial.hpp

Depends on

Code

#pragma once

#include "./base.hpp"

namespace matumoto {
  constexpr ll binomial(ll n, ll r) {
    ll res = 1;
    for (ll i = 0; i < r; i++) {
      res *= n - i;
      res /= i + 1;
    }
    return res;
  }
} // namespace matumoto
#line 2 "math/binomial.hpp"

#line 2 "math/base.hpp"

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

namespace matumoto {
  constexpr ll binomial(ll n, ll r) {
    ll res = 1;
    for (ll i = 0; i < r; i++) {
      res *= n - i;
      res /= i + 1;
    }
    return res;
  }
} // namespace matumoto
Back to top page