QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#606836#1266. Visual Cubecyj888AC ✓1ms3656kbC++111.6kb2024-10-03 12:34:202024-10-03 12:34:24

Judging History

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

  • [2024-10-03 12:34:24]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3656kb
  • [2024-10-03 12:34:20]
  • 提交

answer

#include <bits/stdc++.h>
#define ott(i,l,r) for (int i = l; i <= r; i ++)
using namespace std;
int read () {
	int x = 0; bool f = 0; char c = getchar ();
	while (!isdigit (c)) f |= (c == '-'), c = getchar ();
    while (isdigit (c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar ();
    return f ? -x : x;
}
typedef long double db;
const int N = 155;
int T, a, b, c, n, m;
char ans[N][N];
void sol () {
	a = read (), b = read (), c = read ();
	n = 1 + 2 * b + 2 * c, m = 1 + 2 * a + 2 * b; 
	ott (i, 1, n)
	    ott (j, 1, m)
	        ans[i][j] = '.';
	ott (i, 1, b + 1) 
	    ott (j, 1, a + 1) {
	    	int x = i * 2 - 1, y = (b - i + 1 + j) * 2 - 1;
	    	ans[x][y] = '+'; if (j != a + 1) ans[x][y + 1] = '-';
		}
	ott (i, 1, b) 
	    ott (j, 1, a + 1) {
	    	int x = i * 2, y = (b - i + j) * 2;
	    	ans[x][y] = '/';
		}
	ott (i, b + 1, (n + 1) / 2) {
		ott (j, 1, a + 1) {
			int x = i * 2 - 1, y = j * 2 - 1;
			ans[x][y] = '+' ; if (j != a + 1) ans[x][y + 1] = '-';
		}
	}
    ott (i, b + 1, n / 2) {
    	ott (j, 1, a + 1) {
    		int x = i * 2, y = j * 2 - 1;
    		ans[x][y] = '|';
		}
	}
	ott (i, 1, c + 1) {
		ott (j, 1, b + 1) {
			int x = (i + j - 1) * 2 - 1, y = m - (j - 1) * 2;
			ans[x][y] = '+'; if (j != b + 1) ans[x + 1][y - 1] = '/';
		}
	}
	ott (i, 1, c) {
		ott (j, 1, b + 1) {
			int x = (i + j - 1) * 2, y = m - (j - 1) * 2;
			ans[x][y] = '|';
		}
	}
	ott (i, 1, n) {
		ott (j, 1, m) cout << ans[i][j];
		puts ("");
	}
	return ;
	        
}
int main () {
	//freopen ("draw.in", "r", stdin);
	//freopen ("draw.out", "w", stdout);
	T = read (); while (T --) sol ();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3628kb

input:

2
1 1 1
6 2 4

output:

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

result:

ok 18 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 3656kb

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