寄一位星神陨落
查看原帖
寄一位星神陨落
1274811
MaskedFools_Sparkle楼主2024/11/9 15:59

十年OI一场空 不关注释见祖宗 不加取值见祖宗 变量小写见祖宗

(寄

#include<bits/stdc++.h>
#define int long long
using namespace std;

int d[10][10] = { {0,1},{1,0},{0,-1},{-1,0} };
int t = 10, n = 1e3 + 10, m = 1e3 + 10, k = 1e6 + 10, x, y, index, ans;
char real_map[1010][1010];
bool rec_map[1010][1010];

void init()
{
	--x;
	--y;
	for (int times1 = 0; times1 < n; ++times1)
		for (int times2 = 0; times2 < m; ++times2)
			scanf("%c",real_map[times1][times2]);

	for (int times1 = 0; times1 < n; ++times1)
		for (int times2 = 0; times2 < m; ++times2)
			rec_map[times1][times2] = 0;
	ans = 1;
}

signed main()
{
	//	freopen("explore.in","r",stdin);
	//	freopen("explore.out","w",stdout);
	cin >> t;
	while (t--)
	{
		cin >> n >> m >> k >> x >> y >> index;
		init();
		for (int times = 0; times < k; ++times)
		{
			rec_map[x][y] = 1;
			if (x + d[index % 4][0] < 0 || y + d[Index % 4][1] < 0 || real_map[x + d[index % 4][0]][y + d[index % 4][1]] != '.')
			{
				++index;
				continue;
			}
			x = x + d[index % 4][0];
			y += d[index % 4][1];
			if (!rec_map[x][y])
				++ans;
		}
		cout << ans << '\n';
	}
}

(仅作抒情,违规紫衫

2024/11/9 15:59
加载中...