Logo
(追記) (追記ここまで)

27022번 - Cow Parade 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB29252488.889%

문제

Farmer John's cows are participating in the annual Bovington, Wisconsin Cow Parade. The streets in this city form a rectangular grid: they all run north-south or east-west and are equally spaced. Farmer John's cattle parade through the streets.

The cows, being meticulous record keepers, recorded the path of their parade. They wrote exactly a series of D (1 ≤ D ≤ 1,000) directions, such as "north for 3 blocks", then "east for 2 blocks", etc. The distance traveled was always in the range 1..10,000. See the sample data for some of the silly ways the cows recorded their march.

After the parade, the cows wanted to know how many different streets they paraded on. If they paraded on one street, left it, and later paraded on the same street, they only count that street once.

입력

  • Line 1: A single integer, D
  • Lines 2..N+1: Each line describes a sequence part of the parade route and contains:
    • A character representing the direction ('N', 'S', 'E', or 'W')
    • the number of blocks travelled in that direction.

출력

  • Line 1: A single integer containing the number of unique streets visited by the cows.

제한

예제 입력 1

6
N 1
N 4
E 2
S 5
W 2
S 4

예제 출력 1

4

힌트

[The "N 1", "N 4", and "S 4" are all on the same street. The others are on different unique streets.

출처

Olympiad > USA Computing Olympiad > 2003-2004 Season > USACO March 2004 Contest > Blue 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /