fork download
  1.  
  2.  
  3. #include <bits/stdc++.h>
  4. #define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i)
  5. #define fi first
  6. #define se second
  7. #define el "\n"
  8. #define pb push_back
  9. #define sz(a) (int)a.size()
  10. #define FILL(a, x) memset(a, x, sizeof(a))
  11.  
  12. using namespace std;
  13. typedef long long ll;
  14. typedef pair<int, int> ii;
  15. const int N = (int)1e6+3;
  16. int n;
  17. int a[100];
  18.  
  19. void Xl(){
  20. /// In ra day nhi phan do dai n
  21. FOR(i, 1, n) cout << a[i] << " ";
  22. cout << el;
  23.  
  24. }
  25.  
  26. void CHL(int i)
  27. {
  28. FOR(j, 1, n){
  29. a[i] = j;
  30. if (i == n) Xl();
  31. else CHL(i+1);
  32. }
  33. }
  34.  
  35.  
  36. int main()
  37. {
  38. ios_base::sync_with_stdio(false);
  39. cin.tie(NULL); cout.tie(NULL);
  40. cin >> n;
  41. CHL(1);
  42. return 0;
  43. }
  44.  
  45.  
  46.  
  47.  
Success #stdin #stdout 0.01s 5328KB
stdin
Standard input is empty
stdout
Standard output is empty