奇诡现象
  • 板块灌水区
  • 楼主bblsy
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/12/22 11:11
  • 上次更新2024/12/22 14:38:47
查看原帖
奇诡现象
1418224
bblsy楼主2024/12/22 11:11

luogu 如下实例:

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[1001][1001],dp[1002][1002];
	int n,m;
	cin >> n >> m;
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cin >> a[i][j];
		}
	}
    //cout << m << endl;
return 0;
}
//------------------------
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	cin >> n >> m;
	int a[n][m],dp[n+2][m+2];
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			//cout << m << endl;
			cin >> a[i][j];
		}
	}
//cout << m << endl;
return 0;
}

在luogu IDE上运行并使用以下数据时,会发现后者的m被改变成9,取消注释可以发现当输入到第三排第四个时,m改为9,猜测为a的坐标与m重合。

3 7
6 5 3 7 9 2 7
2 4 3 5 6 8 6
4 9 9 9 1 5 8

这是为什?

2024/12/22 11:11
加载中...