시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
5 초 | 512 MB | 14 | 5 | 5 | 35.714% |
Given an arranged chess board with pieces, figure out the total number of different ways in which any piece can be killed in one move. Note: in this problem, the pieces can be killed despite of the color.
For example, if there are 3 pieces King is at B2, Pawn at A1 and Queen at H8 then the total number of pieces that an be killed is 3. H8-Q can kill B2-K, A1-P can kill B2-K, B2-K can kill A1-P
A position on the chess board is represented as A1, A2... A8,B1.. H8
Pieces are represented as
The first line of the input gives the number of test cases, T. T Test cases follow. Each test case consists of the number of pieces , N. N lines follow, each line mentions where a piece is present followed by - with the piece type
Limits
For each test case, output one line containing "Case #x: y", where x is the test case number (starting from 1) and y is the the total number of different ways in which any piece can be killed.
2 2 A1-K A8-Q 3 B2-K A1-P H8-Q
Case #1: 1 Case #2: 3
Contest > Google > Google's Coding Competitions > Google APAC 2015 University Graduates Test > Round D APAC Test D2번
Contest > Google > Kick Start > Google Kick Start 2014 > Round D D2번