【Educational Codeforces Round 16】Codeforces 710A King Moves
来源:互联网 发布:c语言大小写转换循环 编辑:程序博客网 时间:2024/05/17 20:26
The only king stands on the standard chess board. You are given his
position in format “cd”, where c is the column from ‘a’ to ‘h’ and d
is the row from ‘1’ to ‘8’. Find the number of moves permitted for the
king.Check the king’s moves here
https://en.wikipedia.org/wiki/King_(chess). King moves from the
position e4 InputThe only line contains the king’s position in the format “cd”, where
‘c’ is the column from ‘a’ to ‘h’ and ‘d’ is the row from ‘1’ to ‘8’.
OutputPrint the only integer x — the number of moves permitted for the king.
打表。
#include<cstdio>#include<cstring>int main(){ int i,j,k,x,y,z; char c; x=getchar()-'a'+1; y=getchar()-'0'; if ((x==1||x==8)&&(y==1||y==8)) printf("3\n"); else { if (x==1||x==8||y==1||y==8) printf("5\n"); else printf("8\n"); }}
0 0
- 【Educational Codeforces Round 16】Codeforces 710A King Moves
- Educational Codeforces Round 16 A. King Moves
- 【CodeForces】〖 Educational Codeforces Round 16〗A. King Moves
- Educational Codeforces Round 16 A. King Moves【模拟】
- codeforces 710A-King Moves
- Codeforces 710A- King Moves
- CodeForces-710A. King Moves
- 【模拟】Codeforces 710A King Moves
- Codeforces Problem 710A King Moves(implementation)
- 【Educational Codeforces Round 16】 Codeforces 710E Generate a String
- Educational Codeforces Round 16 (A-E)
- Educational Codeforces Round 16
- Educational Codeforces Round 16
- Educational Codeforces Round 16
- CodeForces 710A King Moves(第一次打CF)
- Educational Codeforces Round 5 A
- Educational Codeforces Round 20 A
- Educational Codeforces Round 21 A
- 【ITOO技术篇】——jQuery easyui 中datagrid时间无法正常显示
- lightoj 1071 Baker Vai (思维dp)
- wordpress的Error establishing a database connection问题
- leetcode Maximal Rectangle
- Android的布局(一)
- 【Educational Codeforces Round 16】Codeforces 710A King Moves
- Python常用模块介绍
- http协议请求
- 【大数据与云计算开发技术】Hadoop开发中遇到的常见错误总结
- zeppelin入门使用
- cocos2d-x,lua的Layer.onClick点击事件封装
- deep learning keras: 关于动物识别的vgg_16模型与调优
- AngularJS小结
- 第二天 Java基础总结4