题解 | 牛牛的字符菱形
牛牛的字符菱形
https://www.nowcoder.com/practice/11a5040fa894430f9d25fda1be37ddc8
#include <bits/stdc++.h>
using namespace std;
int main() {
string a;
while (cin >> a) { // 注意 while 处理多个 case
int i = -2;
for(;i<=2;i++){
for(int j = 1;j<=abs(i);j++) cout << " ";
for(int j = 1;j<=5-abs(2*i);j++) cout << a;
printf("\n");
}
}
}
// 64 位输出请用 printf("%lld")
查看15道真题和解析