嘻嘻不嘻嘻
2026-07-17 17:16:00
发布于:江苏
15阅读
0回复
0点赞
现在不冷淡了
我更菜
我这个思路没变,优化了一下。
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
for(int t=n-i;t--;){
cout<<" ";
}
for(int t=0;t<i+i-1;t++){
cout<<"*";
}
cout<<'\n';
}
for(int i=0;i<n;i++){
for(int t=n-1;t--;){
cout<<" ";
}
cout<<"*"<<'\n';
}
return 0;
}
我在评论里补充了一下物理知识,感兴趣的看一下。
这里空空如也






有帮助,赞一个