复制一份多占几个格子
运行下面这段程序,它数的是「额外开了几个格子」:
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
vector<int> A = {17, 24, 15, 13, 23};
int extra = 0;
vector<int> copy;
for (int x : A) {
copy.push_back(x);
extra++;
}
cout << extra << endl;
}
(本题用 g++ -std=c++17 -O0 编译。)