SWEA

5356. 의석이의 세로로 말해요

공부정리 2018. 8. 29. 15:30

길이가 1~15인 문자열 5개가 주어질 때


이 문자열을 세로로 읽는 문제다. 



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
using namespace std;
 
int tc;
 
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
 
    cin >> tc;
    for (int t = 1; t <= tc; ++t) {
        char s[5][17= { 0, };
        for (int i = 0; i < 5++i)
            cin >> s[i];
        cout << "#" << t << " ";
        for (int i = 0; i < 15++i) for (int j = 0; j < 5++j)
            if (s[j][i])
                cout << s[j][i];
        cout << '\n';
    }
    return 0;
}
cs