超简单的题
  • 板块灌水区
  • 楼主__lalala__
  • 当前回复9
  • 已保存回复9
  • 发布时间2024/6/22 10:15
  • 上次更新2024/6/22 10:28:42
查看原帖
超简单的题
960459
__lalala__楼主2024/6/22 10:15

我的代码

#include<bits/stdc++.h>
using namespace std;
struct node
{
	int ans;
	bool f;
};
node a[130][130];
int main(void)
{
	int d;
	int n;
	int x, y, k;
	cin >> d >> n;
	for(int i = 0;i < n;i++)
	{
		cin >> x >> y;
		a[x][y].f = 1;
		cin >> k;
		for(int j = x - d;j <= x + d;j++)
		{
			for(int l = y - d;l <= y + d;l++)
			{
				a[j][l].ans += k;
			}
		}
	}
	int max1 = 0, max2 = 0;
	for(int i = 1;i <= 128;i++)
	{
		for(int j = 1;j <= 128;j++)
		{
			cout << a[i][j].ans << ' ';
			if(a[i][j].ans > max1)
			{
				max1 = a[i][j].ans;
				if(a[i][j].f)
				{
					max2++;
				}
			}
			else
			{
				max2 = 0;
			}
		}
	}
	cout << max2 << ' ' << max1 << endl;
	return 0;
}

覆盖的公共场所最多输出有问题

2024/6/22 10:15
加载中...