Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
8155 D班-西瓜 输出米字形 C++ 通过 100 2 MS 264 KB 1125 2025-03-26 17:37:11

Tests(6/6):


#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; char c = 'A'; int col = 2*n-1; int temp = (col-3)/2; for(int i = 1; i<=col/2; i++) { for(int j = 1; j<=i-1; j++) { cout << '.'; } for(int k = 1; k<=3; k++) { if(k<3) { cout << c; for(int l = temp; l>=1; l--) { cout << '.'; } } else { cout << c; for(int j = 1; j<=i-1; j++) { cout << '.'; } } } c++; temp--; cout << endl; } c = 'A'; for(int i = 1; i<=col/2+1; i++) { cout << c++; } c-=2; for(int i = 1; i<=col/2; i++) { cout << c--; } cout << endl; c = 'A' + col/2-1; temp=col/2; int mid_star = 0; for(int i = 1; i<=col/2; i++) { int start_star = temp-i; for(int j = 1; j<=start_star; j++) { cout << '.'; } for(int k = 1; k<=3; k++) { if(k<3) { cout << c; for(int l = 1; l<=mid_star; l++) { cout << '.'; } } else { cout << c; for(int j = 1; j<=start_star; j++ ) { cout << '.'; } } } c--; mid_star++; cout << endl; } return 0; }


测评信息: