简单题。

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-; char s[],R,C,ans; bool check(int a,int b)
{
if(a>=&&a<=&&b>=&&b<=) return ;
return ;
}
int main()
{
scanf("%s",s);
R=s[]-''; C=s[]-'a'+;
ans=; if(check(R-,C-)) ans++;
if(check(R-,C)) ans++;
if(check(R-,C+)) ans++;
if(check(R,C-)) ans++;
if(check(R,C+)) ans++;
if(check(R+,C-)) ans++;
if(check(R+,C)) ans++;
if(check(R+,C+)) ans++; printf("%d\n",ans);
return ;
}

CodeForces 710A King Moves的更多相关文章

  1. codeforces 710A King Moves(水)

    output standard output The only king stands on the standard chess board. You are given his position ...

  2. CodeForces 710A King Moves(水题-越界问题)

    题目链接:http://codeforces.com/problemset/problem/710/A 题目大意:在一个棋盘中给出一个位置,判断该位置周围8个点还有几个点可以摆放棋子. AC代码解释解 ...

  3. 【模拟】Codeforces 710A King Moves

    题目链接: http://codeforces.com/problemset/problem/710/A 题目大意: 国际象棋标准8X8棋盘,国王能往周围8个方向走.输入国王的位置,输出当前国王能往几 ...

  4. CodeForces 710A King Moves (水题)

    题意:给定一个坐标,问你皇后有几个方向可以走. 析:直接格举那八个方向即可. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000 ...

  5. codeforces 710A A. King Moves(水题)

    题目链接: A. King Moves 题意: 给出king的位置,问有几个可移动的位置; 思路: 水题,没有思路; AC代码: #include <iostream> #include ...

  6. [Educational Codeforces Round 16]A. King Moves

    [Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...

  7. Codeforces 1089K - King Kog's Reception - [线段树][2018-2019 ICPC, NEERC, Northern Eurasia Finals Problem K]

    题目链接:https://codeforces.com/contest/1089/problem/K time limit per test: 2 seconds memory limit per t ...

  8. Educational Codeforces Round 16---部分题解

    710A. King Moves 给你图中一点求出它周围有几个可达的点: 除边界之外都是8个,边界处理一下即可: #include<iostream> #include<cstdio ...

  9. Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2) A. The King's Race

    http://codeforces.com/contest/1075/problem/A On a chessboard with a width of nn and a height of nn, ...

随机推荐

  1. [原]Escape From the iOS Sanbox on Jailbreak Device

    just my thinking, 3 ways to escape from sandbox on jailbreak device, to do file copying or execute s ...

  2. iOS由ImageIO.framework实现gif的系统解码

    首先先简单介绍一下gif的几个算是术语吧: frame(帧):一个gif可以简单认为是多张image组成的动画,一帧就是其中一张图片image. frameCount(帧数): 就是一个gif有多少帧 ...

  3. (转)最大似然估计&贝叶斯估计

    最大似然估计&贝叶斯估计 与传统计量模型相对的统计方法,存在 1)参数的解释不同:经典估计:待估参数具有确定值它的估计量才是随机的.如果估计量是无偏的,该估计量的期望等于那个确定的参数.bay ...

  4. python(学习之路一)

    ''' Created on 2013-5-3 @author: lixingle ''' #输出的练习 length=3 width=4; area=length*width print(area) ...

  5. z-index 解析

    很多人对z-index的认识仅止于:z-index是控制元素在页面中的堆叠顺序,z-index值高的元素显示在z-index值低的前面.而其中的原因才很少有人去深究,直到自己在实际项目中碰到由于z-i ...

  6. JS树型菜单

    本树型菜单主要实现功能有:基本的树型菜单,可勾选进行多选项操作. 本树型菜单适合最初级的学者学习,涉及内容不难,下面看代码. 首先看View的代码,第一个<div>用来定义树显示的位置和i ...

  7. 免费的Visual Studio的插件

    在做了深入(的)研究之后(通过在google网站搜索),,我编译了15个免费Visual Studio 2005插件表..其中一些插件将提高您(的)代码(的)质量,,另外一些能使您编译(的)更快,,但 ...

  8. mosquitto awareness when before it's being compiling, and you do settings and testing

    Mostly, this clearify the usage of   ' mosquitto.conf ' in easy-understanding language.   1. compile ...

  9. bin文件和elf文件

    ELF文件格式是一个开放标准,各种UNIX系统的可执行文件都采用ELF格式,它有三种不同的类型: 可重定位的目标文件(Relocatable,或者Object File) 可执行文件(Executab ...

  10. 回收站引发ORACLE查询表空间使用缓慢

    一个哥们问我 ,他们查询 表空间使用率 跑了一个多小时,这个太坑爹了,让我 帮忙优化一下. SQL语句如下 select * from ( select ts.tablespace_name,ts.c ...