안녕하세요. 오늘은 노브를 돌릴거예요.
https://www.acmicpc.net/problem/30617
그냥 문제에 나와있는대로 구현만 하면 됩니다.
다만 주의할 점이 있다면 노브를 돌릴때에만 처리를 해주어야한다는 점입니다.
#include <iostream>
using namespace std;
int main(void)
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int a, b, c, d, i, N, cnt = 0;
    cin >> N;
    for (i = 0; i < N; i++)
    {
        cin >> c >> d;
        if (i > 0)
        {
            if (a == c && a != 0) cnt++;
            if (b == d && b != 0) cnt++;
        }
        if (c == d && c != 0) cnt++;
        a = c; b = d;
    }
    cout << cnt;
}
감사합니다.