RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0461

Clockwise Fence

Gold V 골드 V
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

The fence surrounding Farmer John's largest pasture has fallen into disrepair,
and he has finally decided to replace it with a new fence.

Unfortunately, as Farmer John is laying out the new fence, a large bee ends up
chasing him around the pasture, and as a result, the fence ends up following a
rather irregular path. The fence can be described by a string of characters,
each either "N" (north), "E" (east), "S" (south), or "W" (west). Each
character describes a 1-meter run of the fence. For example, if the string is
NESW, this means the fence starts by moving north for 1 meter, then east for 1
meter, then south for 1 meter, then west for 1 meter, returning to its starting
point.

The fence ends at the position where it started, and this is the only point
visited more than once by the path of the fence (and the starting point is only
re-visited once, at the end). As a result, the fence does indeed enclose a
single connected region of the grassy pasture, even though this region could
have a rather strange shape.

Farmer John is curious if the path in which he laid the fence traveled clockwise
(with the enclosed region on the right side of the fence as one walks along the
path of the fence in the order specified by the string) or counter-clockwise
(with the enclosed region on the left side of the fence).

Problem credits: Brian Dean

제약

Problem credits: Brian Dean

입력 형식

The first line of input contains an integer \(N\) (\(1 \leq N \leq 20\)). Each of
the next \(N\) lines contains a string of length at least 4 and at most 100,
describing a single fence path.

출력 형식

For each of the \(N\) fence paths described in the input, output a line containing
either "CW" (clockwise) or "CCW" (counterclockwise).

예제 1
입력
2
NESW
WSSSEENWNEESSENNNNWWWS
출력
CW
CCW
설명

The two fence paths with @ denoting the starting point:

*>*
^ v
@<*

  *<*<*<*
  v     ^
*<@     *
v       ^
* *>*>* *
v ^   v ^
* *<* * *
v   ^ v ^
*>*>* *>*
문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2020-2021 > February > Bronze

태그

평가 및 의견

Clockwise Fence

개요
출제자 난이도 Gold V 골드 V 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Clockwise Fence

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8