FZU 翻翻棋
来源:互联网 发布:自制选择题软件 编辑:程序博客网 时间:2024/04/29 10:30
翻翻棋Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Description
象棋翻翻棋(暗棋)中双方在4*8的格子中交战,有时候最后会只剩下帅和将。根据暗棋的规则,棋子只能上下左右移动,且相同的级别下,主动移动到地方棋子方将吃掉对方的棋子。将和帅为同一级别。然而胜负在只剩下帅和将的时候已定。
Input
第一行T,表示T组数据。
每组数据共有四行字符串,每行字符串共八个字符
’#’表示空格
’*’表示红方帅
’.’表示黑方将
此时红方先走
每组输入之间没有空行。
Output
每组数据输出一行。若为红方赢输出Red win,否则输出 Black win
Sample Input
1######.######*##################
Sample Output
Black win
解题报告:找规律就OK
code:
#include<iostream>#include<algorithm>#include<stdio.h>#include<queue>#include<stack>#include<math.h>#include<string.h>#include<stdlib.h>using namespace std;typedef long long ll;int main(){ // freopen("input.txt","r",stdin); int t; char s[10][20]; scanf("%d",&t); getchar(); while(t--){ int x,y,xx,yy; for(int i=0;i<4;i++){ for(int j=0;j<8;j++){ scanf("%c",&s[i][j]); if(s[i][j]=='*'){ x=i; y=j; } if(s[i][j]=='.'){ xx=i; yy=j; } } getchar(); } if(int(fabs(x-xx)+fabs(y-yy))%2==0) printf("Black win\n"); else printf("Red win\n"); }}
0 0
- FZU 2230 翻翻棋
- FZU 翻翻棋
- FZU 2230 翻翻棋
- FZU Problem 2230 翻翻棋
- FZU 2230 翻翻棋 (找规律 水题)
- FZU-2230 翻翻棋(博弈论,规律题)
- FZU 2230 2230 翻翻棋(思维水题)
- 翻翻棋
- 翻翻棋
- 翻翻棋
- 翻翻
- 福州大学第十三届程序设计竞赛 Problem B 翻翻棋【bfs】
- 翻翻翻
- FZU
- FZU
- FZU
- FZU
- FZU
- UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not in range(128)
- ADAS高级驾驶辅助系统浅解答
- Framework7中利用download和external实现a标签下载文件和图片
- Html Dom(动态页面的基础)的基本了解
- 关于新建项目如何传至svn
- FZU 翻翻棋
- Android百度地图集成后只显示网格不显示地图问题
- Foreach循环语句的使用
- 接口和抽象类有什么区别
- ajax兼容问题代码
- 解决:System.Data.SqlClient.SqlException: 超出了存储过程、函数、触发器或视图的最大嵌套层数(最大层数为 32).
- Storm源码阅读之SpoutOutputCollector
- ADAS高级驾驶辅助系统
- IO编程