fork download
  1. #define _CRT_SECURE_NO_WARINGS
  2. #include<iostream>
  3. #include<iomanip>
  4. #include<map>
  5. #include<cmath>
  6. #include<algorithm>
  7. #include<string>
  8. #include<vector>
  9. #include<queue>
  10. #include<set>
  11. #include<deque>
  12. #include<stack>
  13. #include<bitset>
  14. #include<fstream>
  15. #include<map>
  16. #include<unordered_map>
  17. using namespace std;
  18. typedef int me;
  19. typedef long long ll;
  20. typedef unsigned long long ull;
  21. #define andrew ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
  22. #define endl '\n'
  23. #define sz(v)(int)(v.size())
  24. #define all(v) v.begin(),v.end()
  25. #define PI 3.1415926535
  26. #define sin(i) (long double)sin(i*PI/180.0);
  27. ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
  28. ull lcm(ll x, ll y) { return x / gcd(x, y) * y; }
  29. void the_end() {
  30. #ifndef ONLINE_JUDGE;
  31. system("pause");
  32. #endif
  33. }
  34. int dy8[] = { 0,0,1,-1,1,-1,-1,1 };
  35. int dx8[] = { 1,-1,0,0,1,-1,1,-1 };
  36. int id8[] = { 0, 1,2,3,4, 5,6, 7 };
  37. // you can be specialist
  38. // soon will be (Cyain)
  39. ll n;
  40. vector<ll>v;
  41. vector<int>s;
  42. void solve(int i)
  43. {
  44. if (i == n + 1)return;
  45.  
  46. for (int j = 1; j <= n; j++)
  47. {
  48.  
  49. if (i != j)
  50. {
  51. s.push_back(j);
  52. }
  53. solve(i+1);
  54. }
  55. }
  56. int main()
  57. {
  58. andrew;
  59. cin >> n;
  60. solve(1);
  61.  
  62. for (auto it : s)
  63. cout << it << " ";
  64. the_end();
  65. }
Success #stdin #stdout 0s 4488KB
stdin
3
stdout
1 1 2 1 2 3 1 2 2 1 1 2 1 2 3 1 2 3 1 1 2 1 2 3 1 2