1、题目说明
2、输入输出说明
3、思路
使用曼哈顿距离
4、c++代码
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n;
cin >> n;
//菱形中心点
int center = n/2;
for(int i = 0;i<n;i++){
for(int j = 0;j<n;j++){
if(abs(i - center) + abs(j - center) <= center) cout << "*";
else cout << " ";
}
cout << endl;
}
return 0;
}