新手来了 尝试运行这个短程序时,我似乎在内存位置出现 Range Error。我不知道这意味着什么,而且有点令人沮丧。
int main()
{
int grains_current = 1;
vector <int> previous;
int sum = 0;
int i = 0;
for (int i = 0; i<10; ++i) sum += previous[i];
previous.push_back(grains_current);
grains_current = grains_current*2;
if (sum >= 10)
cout<<i<<"\t\n\n";