简单题。

#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. queue,指针求最短路的区别

    这里以spfa为例://都用邻接表存边: 指针: int h=1,t=1; q[h]=x; while(h<=t){ int u=q[h]; vis[u]=0; for(int i=head[u ...

  2. Code First 启用迁移时出错 HRESULT:0x80131040

    问题:Enable-Migrations 使用“8”个参数调用“CreateInstanceFrom”时发生异常 (异常来自 HRESULT:0x80131040) PM> Enable-Mig ...

  3. delphi中设置系统时间方法

    procedure TMainFrm.Timer1Timer(Sender: TObject); var   systemtime:Tsystemtime;   dt:TDateTime; begin ...

  4. A2D规则引擎

    A2D规则引擎 写了个简单的规则引擎,普通情况够用了: 比如2家公司有各自的利率计算规则,如下: 在C#方面,没有写在C#的业务逻辑代码中,而是移到了外部规则文件中,如(ACompanyRatePol ...

  5. jsp中获取当前文件路径

    <% String path1 = application.getRealPath(request.getRequestURI()); //当前请求的JSP文件的物理路径 String path ...

  6. 使用Guava进行函数式编程

    本文翻译自Getting Started with Google Guava这本书,如有翻译不足的地方请指出. 在这一章,我们开始注意到使用Guava进行编写代码会更加简单.我们将看看如何使用Guav ...

  7. 新手教程:wordpress博客安装图文教导

    每一个建立博客的新朋友,当准备好域名和主机后,不知道怎么安装博客,我刚建立昆明SEO的时候,也费了很多时间,终于搭建成功,下面是我一步一步实战得来的总结. 第一步:域名解析,根据域名注册商不同,解析操 ...

  8. Arduino 各种模块篇 震动模块 vibrator

    vibrator is a good thing. it has multi-funtionality . :) Now the  vibrator we choose is the one whic ...

  9. ZOJ 1204 一个集合能组成多少个等式

    Additive equations Time Limit : 20000/10000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other ...

  10. 当ArcGIS10.2遇到Teradata

                                    随着计算机技术的不断发展,GIS技术也紧跟IT技术的热潮,从三维技术.到移动技术,从大数据技术到云计算技术,只要IT有的新技术,Esri ...