题解 | #箭形图案#
箭形图案
https://www.nowcoder.com/practice/a6d1081e0c9a42f19e42ed6cd91556c1
#include <stdio.h> int main() { int n; while (scanf("%d", &n) != EOF) { // 注意 while 处理多个 case // 64 位输出请用 printf("%lld") for (int i = n, j = 1; i >= 0, j <= (n + 1); i--, j++) { int num = 2 * i; while (num--) { printf(" "); } num = j; while (num--) { printf("*"); } printf("\n"); } for (int i = 1, j = n; i <= n, j > 0; i++, j--) { int num = 2 * i; while (num--) { printf(" "); } num = j; while (num--) { printf("*"); } printf("\n"); } } return 0; }