题解 | #X形图案#
X形图案
https://www.nowcoder.com/practice/83d6afe3018e44539c51265165806ee4
#include <iostream>
using namespace std;
int main() {
int a;
while (cin >> a) { // 注意 while 处理多个 case
for(int i=1;i<=a;i++)
{
for(int j=1;j<=a;j++)
{
//判断对角线的位置 a[i][i]与a[i][n-i+1]
if(j==i || j==(a-i+1))
{
cout<<"*";
}
else {
cout<<" ";
}
}
cout<<endl;
}
}
}
// 64 位输出请用 printf("%lld")

