Run ID:96372
提交时间:2024-11-07 18:13:35
#include <iostream> using namespace std; int main() { int n, m, cnt; cin >> cnt; while (cnt--) { cin >> n >> m; bool flag = true; while (m--) { for (int i = 0; i < n; i++) { if (i != 0 || flag) { for (int j = 0; j < n; j++) { if (j == i || j == n - i - 1) { cout << "X"; } else cout << " "; } flag = false; cout << endl; } } if (cnt != 0) cout << endl; } } return 0; }