A1090 | [COCI-2006_2007-contest6]#3 MARATON
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Albert, Barbara, Casper, Dinko, Eustahije are starting a marathon game of tic-tac-toe, played on an N×N board.
Initially, all squares on the board are empty and players take turns writing the first letter of their name into any of the empty squares (because the players are elite, no two players have the same first letter).
The game ends when some player places 3 of his or her letters consecutively in a row, column or diagonally. That player is declared the winner.
Write a program that, given the state of the board, determines if the game is over and who won if it is.
Initially, all squares on the board are empty and players take turns writing the first letter of their name into any of the empty squares (because the players are elite, no two players have the same first letter).
The game ends when some player places 3 of his or her letters consecutively in a row, column or diagonally. That player is declared the winner.
Write a program that, given the state of the board, determines if the game is over and who won if it is.
输入格式
The first line of input contains the integer N (1 ≤ N ≤ 30), the size of the board.
The following N lines contain N characters each. The characters will be uppercase letters of the English alphabet or '.' (if the square is empty).
The input data will be such that there is at most one winner.
The following N lines contain N characters each. The characters will be uppercase letters of the English alphabet or '.' (if the square is empty).
The input data will be such that there is at most one winner.
输出格式
If the game is over, output the first letter of the winner's name. If not, output "ongoing" (even if the board is full).
输入输出样例
输入 #1
3 XOC XOC X..
输出 #1
X
输入 #2
4 .... ..A. AAB. .B.B
输出 #2
ongoing
输入 #3
3 ABB AAA BBA
输出 #3
A
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted