//题目不难,格式很烦
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int n;
char in, out;
int num = 0;
while (scanf("%d %c %c", &n, &in, &out) != EOF) {
if (num == 1)
cout << endl;
num = 1;
if (n == 1) {
cout << in << endl;
continue;
}
int m = (n + 1) / 2;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
if ((abs(i - m) == m - 1) && (abs(j - m) == m - 1)) {
putchar(' ');
} else {
for (int k = 0; k <= m - 1; k++) {
if (((abs(i - m) == k) && (abs(j - m) <= k)) ||
((abs(i - m) <= k) && (abs(j - m) == k))) {
if (k % 2 == 0)
putchar(in);
else
putchar(out);
}
}
}
}
cout << endl;
}
}
return 0;
}
杭电OJ 2074 叠筐 C++
最新推荐文章于 2024-06-09 20:18:37 发布