32pts玄关
查看原帖
32pts玄关
794484
huanglihuan楼主2024/9/8 11:39
#include <bits/stdc++.h>
#include <cstdio>
#define int long long
#define ull unsigned long long
#define mod 998244353
#define MOD 1000000007
using namespace std;
const int N = 2e6 + 5,maxn = 3e3 + 5;
int a [N];
inline int read ()
{
	int x = 0;
	bool f = 1;
	char c = getchar ();
	while (c < '0' || c > '9') f = (c == '-' ? !f : f),c = getchar ();
	while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48),c = getchar ();
	return f ? x : -x;
}
inline void write (int x)
{
	if (x < 0) putchar ('-'),x = -x;
	if (x > 9) write (x / 10);
	putchar (x % 10 + '0');
	return ;
}
inline void writes (const char *s)
{
	while (*s && *s != '\n') putchar (*s ++);
	return ;
}
signed main ()
{
	int T = read ();
	while (T --)
	{
		int n = read (),m = read (),k = read ();
		int c [n + 1] [m + 1];
		for (int i = 1;i <= n;i ++)
		{
			for (int j = 1;j <= m;j ++) c [i] [j] = 0;
		}
		int cnt = 0;
		if (k <= n)
		{
			for (int i = 1;i <= n;i ++)
			{
				for (int j = 1;j <= m;j ++)
				{
					if (i == j && cnt < k) cnt ++,cout << 'S';
					else cout << '.';
				}
				cout << endl;
			}
		}
		else if (n == 2)
		{
			int t = k / 2;
			for (int i = 1;i <= m;i ++)
			{
				if (i <= t) cout << 'S';
				else cout << '.';
			}
			cout << endl;
			t = k - k / 2;
			for (int i = 1;i <= m;i ++)
			{
				if (i <= t) cout << 'S';
				else cout << '.';
			}
		}
		else
		{
			int t = min (n,m),f = max (n,m);
			cnt = t;
			for (int i = 1;i <= t;i ++) c [i] [i] = 1;
			for (int i = 1;i <= n;i ++)
			{
				for (int j = 1;j <= m;j ++)
				{
					if (c [i] [j]) cout << 'S';
					else if (cnt < k) cnt ++,cout << 'S';
					else cout << '.';
				}
				cout << endl;
			}
		}
		cout << endl;
	}
	return 0;
} 

2024/9/8 11:39
加载中...