kyopro-lib

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

View on GitHub

:warning: Gray code
(Mylib/Bit/gray_code.cpp)

Operations

Requirements

Notes

Problems

References

Code

#pragma once

namespace haar_lib {
  template <typename Func>
  void gray_code(int n, const Func &f) {
    for (int i = 0; i < (1 << n); ++i) {
      if (not f(i ^ (i >> 1))) break;
    }
  }
}  // namespace haar_lib
#line 2 "Mylib/Bit/gray_code.cpp"

namespace haar_lib {
  template <typename Func>
  void gray_code(int n, const Func &f) {
    for (int i = 0; i < (1 << n); ++i) {
      if (not f(i ^ (i >> 1))) break;
    }
  }
}  // namespace haar_lib
Back to top page