Advertisement
newb_ie

Untitled

Oct 6th, 2021
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. #include "bits/stdc++.h"
  2. using namespace std;
  3.  
  4. int main () {
  5. ios::sync_with_stdio(false);
  6. cin.tie(nullptr);
  7. cout.tie(nullptr);
  8. //~ set<int> st;
  9. //~ st.insert(10);
  10. //~ st.insert(20);
  11. //~ st.insert(30);
  12. //~ st.begin(),st.begin() + 1,st.begin() + 2, st.end()
  13. //~ for (auto x : st) {
  14. //~ cout << x << ' ';
  15. //~ }
  16. //~ cout << '\n';
  17. //~ st.erase(21);
  18. //~ for (auto x : st) {
  19. //~ cout << x << ' ';
  20. //~ }
  21. //~ cout << '\n';
  22. //~ auto it = st.find(20);
  23. //~ if (it == st.end()) {
  24. //~ //amra khuje painai
  25. //~ } else {
  26. //~ //amra paisi
  27. //~ }
  28. //0(n^2) => 100^2 => 1000
  29. //O(n * n - 1)
  30. //~ int n;
  31. //~ cin >> n;
  32. //~ vector<string> a;
  33. //~ for (int i = 0; i < n; ++i) {
  34. //~ string s;
  35. //~ cin >> s;
  36. //~ bool f = false;
  37. //~ //0 + 1 + 2 + 3 + 4 + 5......
  38. //~ //n => 0 + 1 + 2 + 3 + 4....n - 1 = n * (n - 1)
  39. //~ for (int j = 0; j < (int) a.size(); ++j) {
  40. //~ if (s == a[j]) {
  41. //~ f = true;
  42. //~ break;
  43. //~ }
  44. //~ }
  45. //~ a.push_back(s);
  46. //~ if (f == true) {
  47. //~ cout << "YES\n";
  48. //~ } else {
  49. //~ cout << "NO\n";
  50. //~ }
  51. //~ }
  52. //~ set<string> st;
  53. //~ int n;
  54. //~ cin >> n;
  55. //~ for (int i = 0; i < n; ++i) {
  56. //~ string s;
  57. //~ cin >> s;
  58. //~ if (st.find(s) == st.end()) {
  59. //~ //painai
  60. //~ cout << "NO\n";
  61. //~ } else {
  62. //~ //paisi
  63. //~ cout << "YES\n";
  64. //~ }
  65. //~ st.insert(s);
  66. //~ }
  67. //~ set<int> st;
  68. //~ int n;
  69. //~ cin >> n;
  70. //~ for (int i = 0; i < n - 1; ++i) {
  71. //~ int x;
  72. //~ cin >> x;
  73. //~ st.insert(x);
  74. //~ }
  75. //~ for (int i = 1; i <= n; ++i) {
  76. //~ if (st.find(i) == st.end()) {
  77. //~ cout << i << '\n';
  78. //~ return 0;
  79. //~ }
  80. //~ }
  81. //upper_bound,lower_bound
  82. //~ set<int> st;
  83. //~ st.insert(10);
  84. //~ st.insert(20);
  85. //~ st.insert(30);
  86. //~ int x = 10;
  87. //~ auto it = st.upper_bound(x); //20
  88. //~ auto it2 = st.lower_bound(x); //10
  89. //~ cout << *it << '\n';
  90. //~ cout << *it2 << '\n';
  91. //~ multiset<int> st;
  92. //~ st.insert(20);
  93. //~ st.insert(10);
  94. //~ st.insert(10);
  95. //~ st.insert(10);
  96. //~ for (auto x : st) {
  97. //~ cout << x << ' ';
  98. //~ }
  99. //~ int x = 10;
  100. //~ cout << st.count(x); //x koto bar ache st er moddhe
  101. vector<int> a = {1,2,3,1,2,1,2,1,3,1,4,5};
  102. int count[6];
  103. for (int i = 0; i < 6; ++i) {
  104. count[i] = 0;
  105. }
  106. //count[1] = 0 + 1 + 1, count[2] = 0 + 1,count[3] = 0 + 1,count[4] = 0,count[5] = 0
  107. for (auto x : a) {
  108. count[x]++;
  109. }
  110. cout << count[3] << '\n';
  111. }
  112.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement