QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#182749 | #1266. Visual Cube | Ishy | AC ✓ | 1ms | 3776kb | C++14 | 2.7kb | 2023-09-18 15:02:23 | 2023-09-18 15:02:24 |
Judging History
answer
#include<bits/stdc++.h>
#define LL long long
#define DB double
#define MOD 1000000007
#define ls(x) (x << 1)
#define rs(x) (x << 1 | 1)
#define lowbit(x) ((-x) & x)
#define MP make_pair
#define VI vector<int>
#define VL vector<LL>
#define VII VI::iterator
#define VLI VL::iterator
#define all(x) x.begin(), x.end()
#define EB emplace_back
#define PII pair<int, int>
#define SI set<int>
#define SII SI::iterator
#define fi first
#define se second
using namespace std;
template<typename T> void chkmn(T &a, const T &b) { (a > b) && (a = b); }
template<typename T> void chkmx(T &a, const T &b) { (a < b) && (a = b); }
void Inc(int &a, const int &b) { ((a += b) >= MOD) && (a -= MOD); }
void Dec(int &a, const int &b) { ((a -= b) < 0) && (a += MOD); }
void Mul(int &a, const int &b) { a = 1LL * a * b % MOD; }
void Sqr(int &a) { a = 1LL * a * a % MOD; }
int inc(const int &a, const int &b) { return (a + b >= MOD) ? a + b - MOD : a + b; }
int dec(const int &a, const int &b) { return (a - b < 0) ? a - b + MOD : a - b; }
int mul(const int &a, const int &b) { return 1LL * a * b % MOD; }
int sqr(const int &a) { return 1LL * a * a % MOD; }
int qwqmi(int x, int k = MOD - 2)
{
int res = 1;
while(k)
{
if(k & 1) Mul(res, x);
k >>= 1, Sqr(x);
}
return res;
}
const int N = 105;
int T, a, b, c, n, m;
char ans[N][N];
void paintH1(int row, int p)
{
// printf("H1 %d %d\n", row, p);
for(int i = 0; i <= a; ++i)
ans[row][p + 2 * i] = '+';
for(int i = 0; i < a; ++i)
ans[row][p + 2 * i + 1] = '-';
}
void paintH2(int row, int p)
{
// printf("H2 %d %d\n", row, p);
for(int i = 0; i <= a; ++i)
ans[row][p + 2 * i] = '/';
}
void paintV1(int col, int p)
{
// printf("V1 %d %d\n", col, p);
for(int i = 0; i <= c; ++i)
ans[p - 2 * i][col] = '+';
for(int i = 0; i < c; ++i)
ans[p - 2 * i - 1][col] = '|';
}
void paintV2(int col, int p)
{
for(int i = 0; i <= c; ++i)
ans[p - 2 * i][col] = '/';
}
void work()
{
scanf("%d %d %d", &a, &b, &c);
for(int i = 0; i < N; ++i)
for(int j = 0; j < N; ++j)
ans[i][j] = '.';
n = 2 * (b + c) + 1;
m = 2 * (a + b) + 1;
for(int i = 0; i <= b + c; ++i)
{
int row = 1 + 2 * i;
int p = max(1, m - 2 * a - 2 * i);
paintH1(row, p);
}
for(int i = 1; i <= b; ++i)
{
int row = 2 * i;
int p = m - 2 * a - 2 * i + 1;
paintH2(row, p);
}
for(int i = 0; i <= a + b; ++i)
{
int col = m - 2 * i;
int p = min(n, 2 * c + 2 * i + 1);
paintV1(col, p);
}
for(int i = 1; i <= b; ++i)
{
int col = m - 2 * i + 1;
int p = 2 * c + 2 * i;
paintV2(col, p);
}
for(int i = 1; i <= n; ++i)
{
for(int j = 1; j <= m; ++j)
putchar(ans[i][j]);
puts("");
}
}
int main()
{
scanf("%d", &T);
while(T--) work();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
2 1 1 1 6 2 4
output:
..+-+ ././| +-+.+ |.|/. +-+.. ....+-+-+-+-+-+-+ .../././././././| ..+-+-+-+-+-+-+.+ ./././././././|/| +-+-+-+-+-+-+.+.+ |.|.|.|.|.|.|/|/| +-+-+-+-+-+-+.+.+ |.|.|.|.|.|.|/|/| +-+-+-+-+-+-+.+.+ |.|.|.|.|.|.|/|/. +-+-+-+-+-+-+.+.. |.|.|.|.|.|.|/... +-+-+-+-+-+-+....
result:
ok 18 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3776kb
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