A and B and Chess 519A
来源:互联网 发布:windows 安全 编辑:程序博客网 时间:2024/05/17 01:12
python 版答案
原问题:
A and B are preparing themselves for programming contests.
To train their logical thinking and solve problems better, A and B decided to play chess. During the game A wondered whose position is now stronger.
For each chess piece we know its weight:
- the queen's weight is 9,
- the rook's weight is 5,
- the bishop's weight is 3,
- the knight's weight is 3,
- the pawn's weight is 1,
- the king's weight isn't considered in evaluating position.
The player's weight equals to the sum of weights of all his pieces on the board.
As A doesn't like counting, he asked you to help him determine which player has the larger position weight.
AC的答案:
W = 0B = 0for i in range(0,8): a = input() for j in a: if j == 'Q': W = W + 9 elif j == 'R': W = W + 5 elif j == 'B': W = W + 3 elif j == 'N': W = W + 3 elif j == 'P': W = W + 1 elif j == 'q': B = B + 9 elif j == 'r': B = B + 5 elif j == 'b': B = B + 3 elif j == 'n': B = B + 3 elif j == 'p': B = B + 1 if B>W: print('Black')elif B<W: print('White')else: print('Draw')
阅读全文
0 0
- A and B and Chess 519A
- A. A and B and Chess
- 519A - A and B and Chess【implementation】
- coderforce 519A A and B and Chess
- A. Kalevitch and Chess
- A. Little Elephant and Chess
- A. Kalevitch and Chess【思维】
- 7A Kalevitch and Chess
- Codeforces Round #294 (Div. 2) -- A. A and B and Chess
- Codeforces Round #294 (Div. 2) -- A. A and B and Chess
- CF:259A. Little Elephant and Chess
- codeforces 7A - Kalevitch and Chess
- code forces 7A Kalevitch and Chess
- Codeforces 7A Kalevitch and Chess
- CodeForces 7A Kalevitch and Chess
- 【取巧遍历】#7 A. Kalevitch and Chess
- CodeForces 7A Kalevitch and Chess
- CodeForces 7A Kalevitch and Chess
- 数据结构与算法_选择排序
- document.getElementById和docuement.querySelector的区别
- 不可滑动的 Listview(NoScrollListView)
- pyspark之MLlib学习【加载和转换数据】(1)
- android Path.setFillType(Path.FillType ft) 设置填充方式
- A and B and Chess 519A
- SpringCloud系列:服务注册与发现、负责均衡、hystrix服务降级的实现
- leetcode 498. Diagonal Traverse 矩阵对角遍历
- 如何安装3.6版本的scikit-learn(windows 7 64bit)
- Linux-SSH:WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED解决方法
- jquery select默认选中 jquery checkbox默认选中 jquery radio默认选中
- Tomcat在Linux上的安装与配置
- recyclerView多条目布局
- 线上性能问题排查工具btrace使用例子