Skip to content

Commit

Permalink
Add 06929.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiyabye committed Jul 25, 2024
1 parent 36a3467 commit 58feefa
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions 06xxx/06929.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <iostream>
using namespace std;

void solve(void) {
int h; cin >> h;

for (int i=1; i<=h; i+=2) {
for (int j=0; j<i; j++) cout << "*";
for (int j=i; j<2*h-i; j++) cout << " ";
for (int j=2*h-i; j<2*h; j++) cout << "*";
cout << "\n";
}
for (int i=h-2; i>=1; i-=2) {
for (int j=0; j<i; j++) cout << "*";
for (int j=i; j<2*h-i; j++) cout << " ";
for (int j=2*h-i; j<2*h; j++) cout << "*";
cout << "\n";
}
}

int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);

solve();
return 0;
}

0 comments on commit 58feefa

Please sign in to comment.