mirror of
https://github.com/wczffl-503/OI-Codes.git
synced 2025-07-07 18:06:58 +08:00
Upload Codes: AtCoder ABC 395
This commit is contained in:
42
AtCoder/abc395/B_Make_Target.cpp
Normal file
42
AtCoder/abc395/B_Make_Target.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include <bits/stdc++.h>
|
||||
#define lo long long
|
||||
#define InF InT_MAX
|
||||
#define LLM LOnG_LOnG_MAX
|
||||
#define endl "\n"
|
||||
|
||||
using namespace std;
|
||||
/*
|
||||
toothless. #17
|
||||
@fredcss_dev
|
||||
*/
|
||||
|
||||
int n;
|
||||
|
||||
void wczffl_503()
|
||||
{
|
||||
vector<vector<char>> grid(n, vector<char>(n, '.'));
|
||||
for (int i = 1; i <= n; ++i) {
|
||||
int j = n + 1 - i;
|
||||
if (i > j) continue;
|
||||
|
||||
char fillChar = (i % 2 == 1) ? '#' : '.';
|
||||
|
||||
for (int k = i - 1; k < j; ++k) {
|
||||
for (int l = i - 1; l < j; ++l) {
|
||||
grid[k][l] = fillChar;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < n; ++i) {
|
||||
for (int j = 0; j < n; ++j) {
|
||||
cout << grid[i][j];
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
|
||||
signed main() {
|
||||
cin >> n;
|
||||
wczffl_503();
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user