Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int N = 500;
- bool board[N + 10][N + 10];
- void fillBoard(int idx, int x){
- if(x <= 0){
- return;
- }
- for(int i = idx; i < idx + x; ++i){
- board[i][idx] = true;
- board[idx][i] = true;
- board[idx + x - 1][i] = true;
- board[i][idx + x - 1] = true;
- }
- fillBoard(idx + 2, x - 4);
- }
- int main(){
- int sz;
- scanf("%d", &sz);
- fillBoard(1, sz);
- for(int i = 1; i <= sz; ++i){
- for(int j = 1; j <= sz; ++j){
- if(board[i][j]){
- cout << '*';
- } else {
- cout << '-';
- }
- }
- cout << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement