B-1027
来源:互联网 发布:淘宝客做推广有用吗 编辑:程序博客网 时间:2024/06/16 14:39
#include<cstdio>int main(){ int n; char c; while(scanf("%d %c", &n, &c)==2){ int x; for(x = 1; x < 25; x++) if(2*x*x<=n+1 && 2*(x+1)*(x+1)>n+1) break; int cnt_space, cnt_sign; for(int i = x; i > 0; i--){ cnt_space = x-i; while(cnt_space--) printf(" "); cnt_sign = 2*i-1; while(cnt_sign--) printf("%c", c); printf("\n"); } for(int i = 2; i <= x; i++){ cnt_space = x-i; while(cnt_space--) printf(" "); cnt_sign = 2*i-1; while(cnt_sign--) printf("%c", c); printf("\n"); } printf("%d\n", n+1-2*x*x); } return 0;}