题解
2024-12-10 17:03:20
发布于:北京
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=0;i<n/2;i++)
{
for(int j=0;j<i;j++)
{
cout<<" ";
}
for(int x=0;x<n-2i;x++)
{
cout<<"";
}
cout<<endl;
}
for(int i=n/2;i>=0;i--)
{
for(int j=i;j>0;j--)
{
cout<<" ";
}
for(int x=n-2i;x>0;x--)
{
cout<<"";
}
cout<<endl;
}
return 0;
}
全部评论 3
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n / 2; i++) {
for (int j = 0; j < i; j++) {
cout << " ";
}
for (int x = 0; x < n - 2 * i; x++) {
cout << "";
}
cout << endl;
}
for (int i = n / 2; i >= 0; i--) {
for (int j = i; j > 0; j--) {
cout << " ";
}
for (int x = n - 2 * i; x > 0; x--) {
cout << "";
}
cout << endl;
}
return 0;
}2天前 来自 山东
0``cpp
#include <iostream>using stdcin;
using stdcout;
using std::endl;
int main() {
int n;
cin >> n;
for (int i = 0; i < n / 2; i++) {
for (int j = 0; j < i; j++) {
cout << " ";
}
for (int x = 0; x < n - 2 * i; x++) {
cout << "";
}
cout << endl;
}
for (int i = n / 2; i >= 0; i--) {
for (int j = i; j > 0; j--) {
cout << " ";
}
for (int x = n - 2 * i; x > 0; x--) {
cout << "";
}
cout << endl;
}
return 0;
}2天前 来自 山东
0#include <iostream>
using stdcin;
using stdcout;
using std::endl;
int main() {
int n;
cin >> n;
for (int i = 0; i < n / 2; i++) {
for (int j = 0; j < i; j++) {
cout << " ";
}
for (int x = 0; x < n - 2 * i; x++) {
cout << "";
}
cout << endl;
}
for (int i = n / 2; i >= 0; i--) {
for (int j = i; j > 0; j--) {
cout << " ";
}
for (int x = n - 2 * i; x > 0; x--) {
cout << "";
}
cout << endl;
}
return 0;
}2天前 来自 山东
0






有帮助,赞一个