Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- vector<int> T;
- int x;
- void binary(int n, int i){
- if(n==T.size()){
- cout<<T[0];
- for(int j=1; j<x; ++j) cout<<' '<<T[j];
- cout<<endl;
- }
- else{
- T[n]=0;
- binary(n+1, 1-i);
- T[n]=1;
- binary(n+1,i);
- }
- }
- int main(){
- int n;
- cin>>n;
- x = n;
- T = vector<int> (n);
- binary(0,0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement