Advertisement
LEGEND2004

vector 1

Apr 11th, 2024
909
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #pragma GCC optimize("O3")
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. #define int long long
  6. #define double long double
  7. #define _FastIO ios_base::sync_with_stdio(0); cin.tie(0)
  8.  
  9. signed main()
  10. {
  11.     _FastIO;
  12.  
  13.     int n;
  14.     cin >> n;
  15.  
  16.     // static array
  17.     //int a[n];
  18.    
  19.     // dynamic array
  20.  
  21.     vector<int> a(n); // size = n ,
  22.     /*for(int i = 0; i < n; i++){
  23.         cin >> a[i];
  24.     }*/
  25.  
  26.     a.push_back(5);
  27.     cout << a.size() << '\n';
  28.     for(int i = 0; i < a.size(); i++){
  29.         cout << a[i] << " ";
  30.     }
  31.     cout << '\n';
  32.     cout << a.back();
  33.  
  34.     /*
  35.     string s;
  36.     cin >> s; // Aa0bcBC123
  37.     sort(s.begin() , s.end());
  38.     cout << s; // 0123ABCabc
  39.     */
  40.     // 0 0 0 5
  41.  
  42.  
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement