acm 梯形
#include<stdio.h> void tixin(int h) { int linewidth=h+(h-1)*2+1; int i,j; for(i=1;i<=h;i++) { for(j=1;j<=linewidth;j++) { if(j<linewidth-h-(i-1)*2) { putchar(' '); } else if(j<linewidth) { putchar('*'); } else { putchar('\n'); } } } } int main(int argc,char** argv) { int h; while(scanf("%d",&h)!=EOF) { tixin(h); } return 0; } /************************************************************** Problem: 1065 Language: C Result: Accepted Time:80 ms Memory:904 kb ****************************************************************/ 来源: https://www.cnblogs.com/xiao-wei-wei/p/3353866.html