kyopro-lib

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

View on GitHub

:x: Enumerate subsets (Descending order)
(Mylib/Bit/enumerate_subsets_desc.cpp)

Operations

Requirements

Notes

Problems

References

Verified with

Code

#pragma once

namespace haar_lib {
  template <typename Func>
  void enumerate_subsets_desc(int a, const Func &f) {
    for (int t = a;; t = (t - 1) & a) {
      if (not f(t)) break;
      if (t == 0) break;
    }
  }
}  // namespace haar_lib
#line 2 "Mylib/Bit/enumerate_subsets_desc.cpp"

namespace haar_lib {
  template <typename Func>
  void enumerate_subsets_desc(int a, const Func &f) {
    for (int t = a;; t = (t - 1) & a) {
      if (not f(t)) break;
      if (t == 0) break;
    }
  }
}  // namespace haar_lib
Back to top page