문제 링크: https://www.acmicpc.net/problem/11945

 

char 배열에 넣고, 출력할 때는 한 행씩 출력하는데 거꾸로 출력하면 좌우가 뒤집힌 모양으로 출력이 됩니다. 직접 뒤집을 필요는 없죠

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

char arr[10][10];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);

	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			cin >> arr[i][j];

	for (int i = 0; i < n; ++i) {
		for (int j = m - 1; j >= 0; --j)
			cout << arr[i][j];
		cout << '\n';
	}


	return 0;
}
반응형