QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#354973#1266. Visual CubestrcmpAC ✓3ms3936kbC++141.9kb2024-03-16 10:07:282024-03-16 10:07:30

Judging History

你现在查看的是最新测评结果

  • [2024-03-16 10:07:30]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3936kb
  • [2024-03-16 10:07:28]
  • 提交

answer

#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
using ld = double;
typedef long long int ll;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using uint = unsigned int;
const int maxn = 1e4 + 10;
const ll inf = 114514191981052013LL;
const int mod = 1e9 + 7;
int T, a, b, c, n, m; char s[505][505];
inline int draw_row(int x, int y, int z) {
	//在 (x, y) 画 +-+,之后画 z - 1 个 -+
	s[x][y] = '+', s[x][y + 1] = '-', s[x][y + 2] = '+'; int now = y + 3;
	for (int i = 1; i < z; i++) s[x][now] = '-', s[x][now + 1] = '+', now += 2;
	return now;
}
inline void draw_col(int x, int y, int z) {
	s[x][y] = '+', s[x + 1][y] = '|', s[x + 2][y] = '+'; int now = x + 3;
	for (int i = 1; i < z; i++) s[now][y] = '|', s[now + 1][y] = '+', now += 2;
}
inline void draw_row_xie(int x, int y, int z) {
	for (int i = y, j = 1; j <= z; i += 2, j++) s[x][i] = '/';
}
inline void draw_col_xie(int x, int y, int z) {
	for (int i = x, j = 1; j <= z; i += 2, j++) s[i][y] = '/';
}
inline void draw_row_zhi(int x, int y, int z) {
	for (int i = y, j = 1; j <= z; i += 2, j++) s[x][i] = '|';
}
inline void wx() {
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) printf("%c", s[i][j]);
		puts("");
	}
}
int main() {
	//freopen("draw.in", "r", stdin);
	//freopen("draw.out", "w", stdout);
	scanf("%d", &T);
	while (T--) {
		scanf("%d%d%d", &a, &b, &c);
		n = 1 + 2 * (b + c), m = 1 + 2 * (a + b);
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= m; j++) s[i][j] = '.';
		}
		int beg = m - 2 * a; int d = 1;
		for (int i = beg; i <= n; i += 2) draw_row(i, 1, a);
		for (int i = beg + 1; i <= n; i += 2) draw_row_zhi(i, 1, a + 1);
		for (int i = beg - 2; i >= 1; i -= 2) {
			d += 2; int u = draw_row(i, d, a) - 1;
			draw_row_xie(i + 1, d - 1, a + 1);
			draw_col(i, u, c);
			draw_col_xie(i + 1, u - 1, c + 1);
		}
		wx();
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3836kb

input:

2
1 1 1
6 2 4

output:

..+-+
././|
+-+.+
|.|/.
+-+..
....+-+-+-+-+-+-+
.../././././././|
..+-+-+-+-+-+-+.+
./././././././|/|
+-+-+-+-+-+-+.+.+
|.|.|.|.|.|.|/|/|
+-+-+-+-+-+-+.+.+
|.|.|.|.|.|.|/|/|
+-+-+-+-+-+-+.+.+
|.|.|.|.|.|.|/|/.
+-+-+-+-+-+-+.+..
|.|.|.|.|.|.|/...
+-+-+-+-+-+-+....

result:

ok 18 lines

Test #2:

score: 0
Accepted
time: 3ms
memory: 3936kb

input:

50
16 19 7
1 8 12
5 15 16
12 9 14
9 2 11
8 11 8
2 1 20
8 16 3
2 7 1
3 17 7
13 13 11
5 9 5
11 10 3
19 4 6
13 17 9
9 17 8
14 3 11
9 4 2
9 6 5
4 9 1
12 8 18
4 7 2
13 3 9
1 13 17
17 11 3
9 2 13
5 7 2
6 18 14
14 14 11
5 12 14
16 7 1
5 19 10
16 9 1
9 8 6
11 7 18
12 20 10
10 16 13
17 12 9
9 9 17
10 2 12
1 ...

output:

......................................+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
...................................../././././././././././././././././|
....................................+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+.+
.................................../././././././././././././././././|/|
...............

result:

ok 1988 lines