tijie
2023-08-20 11:52:50
发布于:广东
9阅读
0回复
0点赞
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <set>
#include <iostream>
#include <stack>
#include<queue>
#include <vector>
#include <map>
#include <iomanip>
using namespace std;
int n,a[100001];
int main(){
//freopen("hello.in","r",stdin);
//freopen("hello.out","w",stdout);
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=n-i;j++){
cout<<" ";
}
for(int j=1;j<=2*i-1;j++){
if(j==1||j==2*i-1)cout<<"*";
else cout<<" ";
}
cout<<endl;
}
for(int i=2;i<=n;i++){
for(int j=1;j<i;j++){
cout<<" ";
}
for(int j=1;j<=2*n-i-i+1;j++){
if(j==1||j==2*n-i-i+1){
cout<<"*";
}
else cout<<" ";
}
cout<<endl;
}
//fclose(stdin);
//fclose(stdout);
return 0;
}
这里空空如也
有帮助,赞一个