SDJ( 수돈재 아님 ㅎ )

[C++] 17013 - Flipper 본문

알고리즘/Backjoon

[C++] 17013 - Flipper

ShinDongJun 2020. 1. 9. 18:57

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

 

17013번: Flipper

The input consists of one line, composed of a sequence of at least one and at most 1000000 characters. Each character is either H, representing a horizontal flip, or V, representing a vertical flip. For 8 of the 15 available marks, there will be at most 10

www.acmicpc.net

 

 

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include<iostream>
#include<algorithm>
#include<cstring>
#define endl '\n'
 
using namespace std;
 
int X[2][2= {{12}, {34}};
char str[1000005];
 
int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    cin >> str;
    int tmp;
 
    for(int i = 0; i < strlen(str); ++i)
    {
        while(str[i] == str[i+1&& i < strlen(str))
            i = i+2;
        
        
        if(str[i] == 'H')
        {
            tmp = X[0][0];
            X[0][0= X[1][0];
            X[1][0= tmp;
 
            tmp = X[0][1];
            X[0][1=  X[1][1];
            X[1][1= tmp;
        }
        else if(str[i] == 'V')
        {
            tmp = X[0][0];
            X[0][0= X[0][1];
            X[0][1= tmp;
 
            tmp = X[1][0];
            X[1][0= X[1][1];
            X[1][1= tmp;
        }
        
    }
 
    cout << X[0][0<< ' ' << X[0][1<< endl;
    cout << X[1][0<< ' ' << X[1][1<< endl;
 
    return 0;
}

'알고리즘 > Backjoon' 카테고리의 다른 글

[C] 1463 - 1로 만들기  (0) 2020.01.09
[C++] 15990 - 1, 2, 3 더하기 5  (0) 2020.01.09
[C++] 17014 - Pretty Average Primes  (0) 2020.01.09
[C++] 17011 - Cold Compress  (0) 2020.01.09
[C++] 2659 - 십자카드 문제  (0) 2020.01.09
Comments