题解 | #K形图案#
K形图案
https://www.nowcoder.com/practice/753cc2662d9949fe826a85f815db0ca4
#include <iostream>
using namespace std;
int main() {
int n;
while (scanf("%d", &n) != EOF) {
for (int i = 1; i < 2*(n + 1); i++) {
if (i < n + 2) {
for (int j = 1; j < (n + 3) - i; j++) cout << "* " ;
cout << endl;
} else {
for (int z = 0; z < i -n ; z++) cout << "* ";
cout << endl;
}
}
}
}
// 64 位输出请用 printf("%lld")

小天才公司福利 1159人发布