求助
如题,出现了以下的几种情况:
-
当 N=5 时,
类中数组初始化均为随机,比较好理解。
-
但是当 N=20000+5 时,
遍历数组 q,tmp得到的值均为0。
但是对于数组dp,它的前一部分是0,大概从 18000 开始出现随机的初始化
代码
可以使用洛谷的 IDE 跑跑看。
#include <bits/stdc++.h>
using namespace std;
const int N=20000+5;
class Test
{
private:
int q[N];
int tmp[N];
int dp[N];
public:
void print()
{
for(auto it:q)
{
cout<<it<<endl;
}
}
};
int main()
{
ios::sync_with_stdio(false);
Test A;
A.print();
}