fork download
  1. /*
  2. * @Author: hungeazy
  3. * @Date: 2026-03-04 23:24:15
  4. * @Last Modified by: hungeazy
  5. * @Last Modified time: 2026-04-01 21:01:44
  6. */
  7. #include <bits/stdc++.h>
  8. using namespace std;
  9. int n,a[19];
  10.  
  11. void Try(int i) //vị trí mình cần xét
  12. {
  13. if (i > n)
  14. {
  15. for (int i = 1; i <= n; i++)
  16. cout << a[i];
  17. cout << endl;
  18. }
  19. else
  20. {
  21. for (int j = 0; j <= 1; j++)
  22. {
  23. a[i] = j;
  24. Try(i+1);
  25. }
  26. }
  27. }
  28.  
  29. int main()
  30. {
  31. ios_base::sync_with_stdio(false);
  32. cin.tie(NULL); cout.tie(NULL);
  33. cin >> n;
  34. Try(1);
  35. return 0;
  36. }
Success #stdin #stdout 0.01s 5300KB
stdin
Standard input is empty
stdout