提交时间:2025-04-09 21:06:55
运行 ID: 9242
#include<bits/stdc++.h> using namespace std; int main() { int n,c=5,b=1; cin>>n; c=n*2-3; for(int i=1; i<=n; i++) { for(int j=1; j<=n-i; j++) { cout<<" "; } for(int k=1; k<=i*2-1; k++) { cout<<"*"; } cout<<endl; } for(int i=1; i<=n-1; i++) { for(int j=1; j<=b; j++) { cout<<" "; } for(int k=1; k<=c; k++) { cout<<"*"; } cout<<endl; b++; c-=2; } }