LoginSignup
0
0

C++ 競プロ 学習記録#2

Posted at

はじめに

配列

  • 配列の大きさ
    arr.size();

  • 整数配列 宣言
    #include <vector>
    vector<int> arr(要素数);

  • 整数の2次元配列 宣言
    vector<vector<int>> arr(要素数1, vector<int>(要素数2));

  • 要素を配列の最後に追加
    arr.push_back(要素);

  • 要素を配列の最後から削除
    arr.pop_back(要素);

ソート

  • 整数2次配列の降順ソート
    #include <algorithm>
    sort(arr.begin(), arr.end(), greater<vector<int>>());
  • 昇順
    sort(arr.begin(), arr.end());

  • 配列のメモリサイズ
    sizeof(arr)
  • markdownで記号をそのまま使いたいとき
    記号の前にバックスラッシュ
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0