B1027

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n,tot=1;
char s;
int i=1;
cin>>n>>s;
for(;tot<=n;i++){
tot=tot+2*(2*i+1);
}
tot=tot-2*(2*(--i)+1);
for(int j=-i+1;j<=i-1;j++){
int k=i;
for(int m=0;m<=2*abs(j);m++){
while(k-abs(j)-1){
cout<<" ";
k--;
}
cout<<s;
}
cout<<endl;
}
cout<<n-tot;
return 0;
}

猜你喜欢

转载自www.cnblogs.com/tao7/p/9768888.html
今日推荐