Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
109070 | 汤奕硕 | 放大的X | C++ | Accepted | 55 MS | 268 KB | 702 | 2025-01-25 16:48:14 |
#include <iostream> using namespace std; void printX(int n) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { // 检查是否在主对角线或副对角线上 if (i == j || i + j == n - 1) { cout << "X"; } else { cout << " "; } } cout << endl; // 每行结束后换行 } cout << endl; // 每个图案结束后空一行 } int main() { int T; cin >> T; // 读取测试数据组数 while (T--) { int n; cin >> n; // 读取每个测试数据的规格 printX(n); // 打印放大的X图案 } return 0; }