[Educational Codeforces Round 16]A. King Moves
[Educational Codeforces Round 16]A. King Moves
试题描述
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 dis 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).
输入
输出
输入示例
e4
输出示例
8
数据规模及约定
无
题解
分支结构。
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <stack>
#include <vector>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <set>
using namespace std;const int BufferSize = 1 << 16;
char buffer[BufferSize], *Head, *Tail;
inline char Getchar() {if(Head == Tail) {int l = fread(buffer, 1, BufferSize, stdin);Tail = (Head = buffer) + l;}return *Head++;
}
int read() {int x = 0, f = 1; char c = getchar();while(!isdigit(c)){ if(c == '-') f = -1; c = getchar(); }while(isdigit(c)){ x = x * 10 + c - '0'; c = getchar(); }return x * f;
}char s[10];int main() {scanf("%s", s);if((s[0] == 'a' || s[0] == 'h') && (s[1] == '1' || s[1] == '8')) return puts("3"), 0;if((s[0] == 'a' || s[0] == 'h') || (s[1] == '1' || s[1] == '8')) return puts("5"), 0;puts("8");return 0;
}
转载于:https://www.cnblogs.com/xiao-ju-ruo-xjr/p/5806704.html
[Educational Codeforces Round 16]A. King Moves相关推荐
- Educational Codeforces Round 16 C. Magic Odd Square 矩阵构造
传送门 文章目录 题意: 思路: 题意: 给你一个奇数nnn,让你构造一个n∗nn*nn∗n的矩阵,矩阵的每个位置依次填上[1,n∗n]之内的数[1,n*n]之内的数[1,n∗n]之内的数,满足每行. ...
- Educational Codeforces Round 106 (Rated for Div. 2)(A ~ E)题解(每日训练 Day.16 )
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 Educational Codeforces Round 106 (Rated for Div. ...
- Educational Codeforces Round 90 (Rated for Div. 2)(A, B, C, D, E)
Educational Codeforces Round 90 (Rated for Div. 2) Donut Shops 思路 分三种情况: a==c/ba == c / ba==c/b这个时候两 ...
- Educational Codeforces Round 24 E. Card Game Again(双指针)
题目链接:Educational Codeforces Round 24 E. Card Game Again 题意: 给你n个数和一个数k. 现在每次可以拿掉前x个数,后y个数,剩下的数的乘积要能被 ...
- Educational Codeforces Round 25 G. Tree Queries
题目链接:Educational Codeforces Round 25 G. Tree Queries 题意: 给你一棵树,一开始所有的点全是黑色,有两种操作. 1 x 将x这个点变为黑色,保证第一 ...
- Educational Codeforces Round 116 (Rated for Div. 2) A B C
Educational Codeforces Round 116 (Rated for Div. 2) A B C A. AB Balance 题意:使得区间内ab的数量的ba的数量相同,每次操作只能 ...
- Educational Codeforces Round 105 (Rated for Div. 2) 题解
Educational Codeforces Round 105 (Rated for Div. 2) A. ABC String 枚举ABC分别为"( "和 " )&q ...
- Educational Codeforces Round 112 (Rated for Div. 2)-A. PizzaForces-题解
目录 Educational Codeforces Round 112 (Rated for Div. 2)-A. PizzaForces Problem Description Input Outp ...
- Educational Codeforces Round 114 (Rated for Div. 2) (A ~ F)全题解
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Educational Codeforces Round 114 (Rated for Div. 2) ...
最新文章
- java构造方法的书写和注意事项(入门可看)
- 关于假冒网站仿冒网易云信官网相关情况的声明
- debian/deepin 15.3 15.4安装jdk 1.7 (或jdk 7),配置默认环境
- vscode 安装包_VS Code的下载与安装(更改插件的安装位置)
- 【图像超分辨率】(SPSR)Structure-Preserving SR with Gradient Guidance
- 二叉树C++ | 实现删除节点_4
- 软件需求与分析课堂讨论
- html缓存效果代码,html5缓存(示例代码)
- Linux 操作系统镜像下载
- sql server 2005 32位+64位、企业版+标准版、CD+DVD 下载地址大全【申明:来源于网络】
- c++打印心形_c语言如何打印心
- C++中的stack类
- STM32LL库使用——SPI通信
- 吴军 阅读与写作50讲 02 如何读懂作者的内心 读后感
- Digispark ATTINY85 Arduino IDE 开发
- python网盘搜索引擎_打造一个蓝奏云网盘搜索引擎
- PY32 单片机离线烧录器使用说明
- Axon Framework简介
- 弘辽科技:淘宝14天降权会恢复吗?多久能恢复正常?
- matlab星三角变压器,变压器星三角接法_主变低压侧三角接法