MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CSES/Intro/GrayCode.cc:4–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2using namespace std;
3
4int main(){
5 int N; cin >> N;
6 for(int i = 0; i <(1<<N); ++i) {
7 int GC = (i^(i>>1));
8 bitset<32>B = GC;
9 for(int k = 0; k < N; ++k) {
10 cout << B[k];
11 }
12 cout << '\n';
13 }
14 return 0;
15}
16
17// 00, 01, 11, 10
18// 0th, 1th, 2th, 3th

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected