Timus Online Judge:2010. Sasha the Young Grandmaster
来源:互联网 发布:淘宝购物的步骤 编辑:程序博客网 时间:2024/06/05 23:49
2010. Sasha the Young Grandmaster
Time limit: 0.5 second
Memory limit: 64 MB
Memory limit: 64 MB
Little Sasha is quite determined to learn to play chess. First of all he of course learned how each chess piece could move (except for the pawn as its moving strategy turned out so complicated that Sasha failed to remember them). Then his older brother Oleg came in to check Sasha’s progress. He chose some square on the chessboard and started putting pieces on the square, one by one, asking his little brother: “How many squares are now under attack?”
That was rather stressful for Sasha and he asked you to help him.
The chessboard is a field of n × n square cells. The rook can move any number of cells, but only horizontally or vertically. The bishop can move any number of cells, but only diagonally. The queen can move any number of cells horizontally, vertically or diagonally. The king can move one cell horizontally, vertically or diagonally and the knight makes “L” shaped moves, that is, it moves either one cell horizontally and two cells vertically or two cells horizontally and one cell vertically.
Input
The first line contains an integer n that is the size of the side of the field (1 ≤ n ≤ 108). The second line contains integers x and y that are the coordinates of the cell where Oleg puts the pieces (1 ≤ x, y ≤ n).
Output
Output the number of cells that can be hit by king, by knight, by bishop, by rook, and by queen, correspondingly. Follow the format from the sample test.
Sample
85 2
King: 8Knight: 6Bishop: 9Rook: 14Queen: 23
Problem Author: folklore
Problem Source: Ural Regional School Programming Contest 2013
Problem Source: Ural Regional School Programming Contest 2013
Tags: none
)又是一道水题,直接发代码:
0 0
- Timus Online Judge:2010. Sasha the Young Grandmaster
- Timus Online Judge 哥德巴赫猜想
- Timus Online Judge 1033 Labyrinth
- Timus Online Judge:1225. Flags
- Timus Online Judge:1119. Metro
- 1350. Canteen Timus Online Judge
- Timus Online Judge 1658 Sum of Digits
- Timus Online Judge 1982 Electrification Plan
- Timus Online Judge 1742 Team building
- Timus Online Judge 2045 Richness of words
- Timus Online Judge 1651 Shortest Subchain
- Timus Online Judge 1045 Funny Game
- Timus Online Judge 1966 Cycling Roads
- Timus Online Judge:1040. Airline Company
- Timus Online Judge:1820. Ural Steaks
- Timus Online Judge:1100. Final Standings
- 【Timus Online Judge 1132】 Square Root
- Timus Online Judge初级题目:1014. Product of Digits
- Android 日志管理框架 NativeLogger
- ubuntu14安装nodejs
- 设计模式之观察者模式
- 操作系统μC/OS-Ⅱ读书笔记(2)
- 利用torque搭建分布式程序运行环境
- Timus Online Judge:2010. Sasha the Young Grandmaster
- 楼新闻
- HDU 5873 Football Games 【模拟】 (2016 ACM/ICPC Asia Regional Dalian Online)
- HDU1171-Big Event in HDU
- LibGdx文档译读(五)Graphics接口
- hdu 5877 Weak Pair(dfs+树状数组)
- Hibernate的HQL中in参数设置
- Android Studio常用快捷键
- 生成短信验证码的方法