QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 262144 MB 満点: 100 ハック可能 ✓

#13211. 国际象棋

統計

你的任务是判断给定的国际象棋局面中,白方是否处于将军(check)、被将死(checkmate)、逼和(stalemate)状态,或者以上情况均不符合。

题目保证:

  1. 棋盘上没有兵(pawn)。
  2. 恰好有一个白王和一个黑王。
  3. 白王已经移动过,且黑王当前未被将军。
  4. 下一步轮到白方走棋。
  5. 不保证该局面可以通过合法的走棋序列从初始局面达到。

输入格式

第一行包含一个整数 $k$ ($1 \le k \le 50$),表示局面数量。

接下来是 $k$ 个局面的描述。每个描述以一个空行开始。随后是 8 行,每行 8 个字符,其中 '.' 表示空格,'N' 表示白马,'B' 表示白象,'R' 表示白车,'Q' 表示白后,'K' 表示白王。字母 'n'、'b'、'r'、'q' 和 'k' 分别表示黑马、黑象、黑车、黑后和黑王。

输出格式

对于每个局面,在单独的一行中打印答案。如果白王处于被将死或逼和状态,分别打印 "checkmate" 或 "stalemate"。如果白王处于被将军状态但未被将死,打印 "check"。否则,打印 "ok"。

样例

输入格式 1

2

RNBKQBNR
........
........
........
........
........
........
rnbkqbnr

K......r
......r.
........
........
........
........
........
.......k

输出格式 1

ok
checkmate

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.