728x90
10798 세로읽기
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
vector<string> str_arr(5);
string input_string;
for (int i = 0; i < 5; ++i)
{
cin >> input_string;
str_arr[i] = input_string;
}
for (int j = 0; j < 15; ++j)
{
for (int i = 0; i < 5; ++i)
{
if (str_arr[i].size()-1 < j)
continue;
cout << str_arr[i][j];
}
}
return 0;
}
- row과 column 접근을 반대로 해보자 하고 문제에 접근해보았다.
- vector에 사용에 아직 익숙하지 않아서 그 부분에서 애를 먹었다.
728x90
'Study > Baekjoon' 카테고리의 다른 글
[백준/C++] 5086 배수와 약수 (0) | 2024.02.19 |
---|---|
[백준/C++] 2563 색종이 (0) | 2024.02.19 |
[백준/C++] 2566 최댓값 (0) | 2024.02.19 |
[백준/C++] 10156 과자 (0) | 2024.02.18 |
[백준/C++] 25206 너의 평점은 (0) | 2024.02.17 |