AC
2025-07-25 11:22:05
发布于:广东
0阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int a;
int main(){
cin>>a;
for(int i=1;i<=a;i++){
for(int j=a-i;j>=1;j--)cout<<" ";
for(int j=i*2-1;j>=1;j--){
if(j==i*2-1||j==1)cout<<"*";
else cout<<" ";
}
cout<<endl;
}
for(int i=a-1;i>=1;i--){
for(int j=a-i;j>=1;j--)cout<<" ";
for(int j=i*2-1;j>=1;j--){
if(j==i*2-1||j==1)cout<<"*";
else cout<<" ";
}
cout<<endl;
}
return 0;
}
这里空空如也
有帮助,赞一个