fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define loop(a) for(a='0';a<='1';a++)
  5. int main()
  6. {
  7. char a,b,c,d,e;
  8. int cnt=0;
  9. loop(a)
  10. loop(b)
  11. loop(c)
  12. loop(d)
  13. {
  14. string s; s+=a; s+=b; s+=c; s+=d;
  15. if(s.find("101")==string::npos) cout<<s<<" ",cnt++;
  16. }
  17.  
  18. cout<<cnt<<"\n";
  19. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
0000 0001 0010 0011 0100 0110 0111 1000 1001 1100 1110 1111 12