3023 마술사 이민혁
2019. 8. 4. 21:24ㆍ알고리즘/백준
왼쪽 위 그림에 대해서 왼쪽 아래 그림을 그린 뒤 이를 대칭하면 모든 그림을 완성할 수 있다
문제: https://www.acmicpc.net/problem/3023
깃허브주소: https://github.com/surinoel/boj/blob/master/3023.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
char mat[101][101]; | |
int main(void) { | |
ios_base::sync_with_stdio(false); | |
cin.tie(nullptr); | |
int n, m; | |
cin >> n >> m; | |
for (int i = 1; i <= n; i++) { | |
for (int j = 1; j <= m; j++) { | |
cin >> mat[i][j]; | |
} | |
} | |
// 왼쪽 아래 | |
for (int i = n + 1; i <= 2 * n; i++) { | |
for (int j = 1; j <= m; j++) { | |
mat[i][j] = mat[2 * n - i + 1][j]; | |
} | |
} | |
// 오른쪽 그 | |
for (int i = 1; i <= 2 * n; i++) { | |
for (int j = m + 1; j <= 2 * m; j++) { | |
mat[i][j] = mat[i][2 * m - j + 1]; | |
} | |
} | |
int a, b; | |
cin >> a >> b; | |
mat[a][b] = (mat[a][b] == '.') ? '#' : '.'; | |
for (int i = 1; i <= 2 * n; i++) { | |
for (int j = 1; j <= 2 * m; j++) { | |
cout << mat[i][j]; | |
} | |
cout << '\n'; | |
} | |
return 0; | |
} |
'알고리즘 > 백준' 카테고리의 다른 글
1952 수영장 (0) | 2019.08.06 |
---|---|
1188 음식 평론가 (0) | 2019.08.05 |
10174 펠린드롬 (0) | 2019.08.03 |
1138 한 줄로 서기 (0) | 2019.08.02 |
1236 성 지키기 (0) | 2019.08.01 |