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. loop(e)
  14. {
  15. string s; s+=a; s+=b; s+=c; s+=d; s+=e;
  16. if(s.find("101")==string::npos) cout<<s<<" ",cnt++;
  17. }
  18.  
  19. cout<<cnt<<"\n";
  20. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
00000 00001 00010 00011 00100 00110 00111 01000 01001 01100 01110 01111 10000 10001 10010 10011 11000 11001 11100 11110 11111 21