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

15079번 - Arggggggh! 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB41627625370.670%

문제

Congratulations! You’ve just inherited a treasure map from a long deceased ancestor who just happened to be a pirate. With visions of gold doubloons and jeweled cutlasses dancing in your head you carefully unfold the map. However instead of the standard picture map with a large X where the treasure is, this map is simply a list of instructions on where to start digging. The first instruction is the starting location, given as two integers x y giving the starting point’s latitude and longitude. After this are instructions like N 7 or SW 6 which specify to walk 7 feet north or 6 feet southwest. After following all of these instructions you will be located over the spot to start digging.

(Just to be clear, moving north increases the y value of your location and keeps the x value constant; moving east increases the x value of your location and keeps the y value constant. You can determine the effects the other directions have on the location.)

Now, you could go through the laborious task of executing each of the instructions one at a time, starting at the initial location, but it would be a lot easier to just calculate the final location and head right there. And that’s the task for this problem.

Oh, one more thing: turns out your ancestor was actually a Pittsburgh Pirate, and the treasure consists of a bunch of old baseballs and a really moldy mitt. I’m sure you can get a doubloon or two for them on eBay.

입력

Input starts with a line containing a single integer n (1 ≤ n ≤ 100) indicating the number of instructions. The next n lines each contain a single instruction. The first instruction consists of two integers x y (0 ≤ x, y ≤ 100) indicating the starting point. The remaining instructions are of the form dir d, were dir is the direction (either N, NE, E, SE, S, SW, W or NW) and d (1 ≤ d ≤ 100) is the distance to walk.

출력

Display the x and y coordinates of the final location, separated by a single space. All coordinates should have a maximum relative or absolute error of 10−6.

제한

예제 입력 1

3
5 5
N 10
W 7

예제 출력 1

-2.00000000 15.00000000

예제 입력 2

3
0 0
NE 10
SE 7

예제 출력 2

12.02081528 2.12132034

힌트

출처

ICPC > Regionals > North America > East Central North America Regional > 2017 East Central Regional Contest 연습 세션 PA번

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

출처

대학교 대회

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

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