Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- BFS
- 그래프
- 유니온 파인드
- 백트래킹
- 유니티
- 시뮬레이션
- 그리디 알고리즘
- 누적 합
- ue5
- 다이나믹 프로그래밍
- 투 포인터
- VR
- 수학
- Unreal Engine 5
- 구현
- 다익스트라
- 스택
- XR Interaction Toolkit
- Team Fortress 2
- 문자열
- c++
- DFS
- 백준
- 우선순위 큐
- 자료구조
- 재귀
- 브루트포스
- 트리
- 정렬
- 알고리즘
Archives
- Today
- Total
1일1알
백준 15886번 내 선물을 받아줘 2 C++ 본문
https://www.acmicpc.net/problem/15886
15886번: 내 선물을 받아줘 2
욱제는 구사과의 열렬한 팬이다. 오늘 욱제는 구사과에게 선물()을 전달해주려고 한다. 지난 며칠간의 관찰 끝에 욱제는 구사과의 이동 패턴을 모두 파악했다. 구사과가 있는 곳은 1×N 크기의 직
www.acmicpc.net
지도에 쓰여 있는대로 이동했을 때, 지도를 벗어나는 경우는 없다. 라는 조건이 있기 때문에 EW 의 개수만 찾으면 된다.
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <set>
#include <map>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <limits.h>
using namespace std;
using int64 = long long;
int n;
string str;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> str;
int ans = 0;
for (int i = 0; i < n - 1; i++) {
if (str[i] == 'E' && str[i + 1] == 'W') ans++;
}
cout << ans;
}