Submission

Status:
[PPPPPPP][PPPPPPPPPPP][PPPPPPPPPPPPPPPPPPPPP]

Score: 100

User: Nathlol2

Problemset: ป้ายไฟ

Language: cpp

Time: 0.087 second

Submitted On: 2024-10-24 13:23:57

#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    int h = n * 2 - 3;
    int w = n * 4 + 3;
    char ueka[h][w];
    memset(ueka, ' ', sizeof ueka);
    //U
    for(int i = 0;i<h;i++){
        ueka[i][0] = '#';
    }
    for(int i = 0;i<n;i++){
        ueka[h - 1][i] = '#';
    }
    for(int i = 0;i<h;i++){
        ueka[i][n - 1] = '#';
    }
    //E
    for(int i = n + 1;i<n * 2 + 1;i++){
        ueka[0][i] = '#';
    }
    for(int i = n + 1;i<n * 2 + 1;i++){
        ueka[h / 2][i] = '#';
    }
    for(int i = n + 1;i<n * 2 + 1;i++){
        ueka[h - 1][i] = '#';
    }
    for(int i = 0;i<h;i++){
        ueka[i][n + 1] = '#';
    }
    //K
    for(int i = 0;i<h;i++){
        ueka[i][n * 2 + 2] = '#';
    }
    int x = h / 2;
    int y = h / 2;
    for(int i = n * 2 + 3;i<n * 3 + 2;i++){
        ueka[x][i] = '#';
        ueka[y][i] = '#';
        x++; y--;
    }
    //A
    for(int i = n * 3 + 3;i<w;i++){
        ueka[0][i] = '#';
    }
    for(int i = n * 3 + 3;i<w;i++){
        ueka[h / 2][i] = '#';
    }
    for(int i = 0;i<h;i++){
        ueka[i][w - n] = '#';
    }
    for(int i = 0;i<h;i++){
        ueka[i][w - 1] = '#';
    }
    //print
    for(int i = 0;i<h;i++){
        for(int j = 0;j<w;j++){
            cout << ueka[i][j];
        }
        cout << endl;
    }
}