fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define fst first
  5. #define snd second
  6.  
  7. typedef long long ll;
  8. typedef pair<int, int> ii;
  9.  
  10. const ll LINF = (ll)1e18;
  11. const int INF = (int)1e9;
  12.  
  13. // tham trị
  14. // pass by value
  15. // a trong ham func chi la ban sao cua thang a minh truyen vao
  16. void func(int a) {
  17. a = a + 5;
  18. cout << "a trong ham func = " << a << '\n';
  19. }
  20.  
  21. // pass by reference
  22. // thao tac truc tiep tren thang a minh truyen vao
  23. void func1(int& a) {
  24. a = a + 5;
  25. cout << "a trong ham func1 = " << a << '\n';
  26. }
  27.  
  28. int main() {
  29. ios::sync_with_stdio(0);
  30. cin.tie(0);
  31. // int n;
  32. // cin >> n;
  33.  
  34. // vector<int> a(n, 0);
  35. // // for (int i = 0; i < n; i++) cin >> a[i];
  36. // // for (int x : a) cin >> x;
  37. // for (int& x : a) cin >> x;
  38.  
  39. // cout << "vector a ban dau la: \n";
  40. // for (int i = 0; i < n; i++) cout << a[i] << ' '; cout << '\n';
  41.  
  42. // sort(a.begin(), a.end()) // sap xep tang dan
  43.  
  44. // cout << "vector a sau khi sap xep: \n";
  45. // for (int x : a) cout << x << ' '; cout << '\n';
  46.  
  47. // // lower_bound, upper_bound
  48. // auto it = lower_bound(a.begin(), a.end(), 5); // trả về con trỏ chỉ đến phần tử đầu tiên >= 5
  49. // auto it1 = upper_bound(a.begin(), a.end(), 5); // trả về con trỏ chỉ đến phần tử đầu tiên > 5
  50.  
  51. // int pos = lower_bound(a.begin(), a.end(), 5) - a.begin();
  52. // int pos1 = upper_bound(a.begin(), a.end(), 5) - a.begin();
  53. // cout << pos << ' ' << pos1 << '\n';
  54. // cout << a[pos] << ' ' << a[pos1] << '\n';
  55. // 2 4 5 8 10
  56. // > >
  57. // >
  58.  
  59. // cout << *it << '\n';
  60. // cout << it1 - a.begin() << '\n';
  61. // for (int x : a) {
  62. // x = x + 5;
  63. // }
  64.  
  65. // for (auto x : a) { // x la tham tri
  66. // x = x + 5;
  67. // }
  68.  
  69. // for (auto& x : a) {
  70. // x = x + 5;
  71. // }
  72.  
  73. // cout << "vector a sau vong for tren: \n";
  74. // for (int i = 0; i < n; i++) cout << a[i] << ' '; cout << '\n';
  75.  
  76. // reverse(a.begin(), a.end()); // đảo ngược vector a
  77. // cout << "vector a sau khi dao nguoc: \n";
  78. // for (auto& it : a) cout << it << ' '; cout << '\n';
  79.  
  80. // Hàm sinh hoán vị
  81.  
  82. // vector<int> c = {2, 1, 3};
  83.  
  84. // sort(c.begin(), c.end());
  85.  
  86. // cout << "Tat ca hoan vi cua c la: \n";
  87.  
  88. // do {
  89. // for (auto& it : c) cout << it << ' '; cout << '\n';
  90. // }
  91. // while (next_permutation(c.begin(), c.end()));
  92.  
  93.  
  94. }
Success #stdin #stdout 0.01s 5300KB
stdin
Standard input is empty
stdout
Standard output is empty