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

5368번 - Escape Route 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB16813711580.986%

문제

ou are surrounded by Imperial warships and must land on a planet to escape. Your best chance is to find a route to the closest planet. Unfortunately the navigation system has been damaged. Your job is to write a program that will find the planet that is closest to your current location. The problem will be described using a mxm grid containing the characters

  • s: your ship
  • w: imperial warship
  • p: planet
  • -: open space

The two dimensional location of an object (i.e., your ship, imperial warship, or planet) corresponds to its location in the grid. For example given a 4x4 grid the locations are specified by the following table.

Recall that the distance between two points (x1, y1) and (x2, y2) is given by the formula

dist = ( (x1 - x2)2 + (y1 - y2)2 )1/2

입력

The first line will have a positive integer, n, specifying the number of data sets to follow. Each data set will have a positive integer, m, on the first line followed by m lines and each line will have exactly m characters. The characters will be either s, w, p, or -.

출력

For each data set print one line with the coordinates of your current location followed by a colon, coordinates of a closest planet followed by a colon, and the distance to that planet formatted to two decimal places.

제한

예제 입력 1

2
4
-wp-
s--w
-w-p
-pw-
5
s--wp
w--pw
-w-p-
p--wp
w--pw

예제 출력 1

(1,0):(0,2):2.24
(0,0):(3,0):3.00

힌트

출처

School > PLU High School Programming Contest > PLU 2011 > Advanced 7번

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

출처

대학교 대회

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

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