跳到正文

个人记录

sdgdfshf

SEF_711约 2 分钟
原文

这是 2026年5月22日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

收录
2026年5月22日
更新
2026年5月22日
篇幅
约 2 分钟

版本

  1. v2当前
  2. v1
C++
#include <bits/stdc++.h>
using namespace std;

int n, m;
int a[505][505], c[505][505];
void print()
{
	for(int i = 1; i <= n; i ++)
	{
		for(int j = 1; j <= n; j ++)
			cout << a[i][j] << " ";
		cout << "\n";
	}
}
void shun(int sx, int sy, int ex, int ey, int ch)
{
	for(int i = 1; i <= ch; i ++)
		for(int j = 1; j <= ch; j ++)
			c[j][ch - i + 1] = a[sx + i - 1][sy + j - 1];
	for(int i = 1; i <= ch; i ++)
		for(int j = 1; j <= ch; j ++)
			a[sx + i - 1][sy + j - 1] = c[i][j];
}
int main()
{
	cin >> n >> m;
	for(int i = 1; i <= n; i ++)
		for(int j = 1; j <= n; j ++)
			a[i][j] = (i - 1) * n + j;
	while(m --)
	{
		int x, y, r, z;
		cin >> x >> y >> r >> z;
		if(z == 0)
			shun(x - r, y - r, x + r, y + r, 2 * r + 1);
		else
		{
			shun(x - r, y - r, x + r, y + r, 2 * r + 1);
			shun(x - r, y - r, x + r, y + r, 2 * r + 1);
			shun(x - r, y - r, x + r, y + r, 2 * r + 1);
		}
	}
	print();
	return 0;
}