output

standard output

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).

King moves from the position e4

Input

The 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'.

Output

Print the only integer x — the number of moves permitted for the king.

Example
input
e4
output
8

分析:给你横纵坐标,瞎搞就好。

 #include<bits/stdc++.h>
using namespace std;
int main()
{
char str[];
ios::sync_with_stdio(false);
cin.tie();
cin >> str;
if(str[] == 'a')
{
if(str[] == '' || str[] == '')
cout << << endl;
else
cout << << endl;
}
else if(str[] == 'h')
{
if(str[] == '' || str[] == '')
cout << << endl;
else
cout << << endl;
}
else if(str[] == '' || str[] == '')
{
cout << << endl;
}
else
cout << << endl;
return ;
}

codeforces 710A King Moves(水)的更多相关文章

  1. CodeForces 710A King Moves (水题)

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

  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,1024000000") #include<cstdio> #inclu ...

  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.158A Next Round (水模拟)

    CodeForces.158A Next Round (水模拟) 题意分析 校赛水题的英文版,坑点就是要求为正数. 代码总览 #include <iostream> #include &l ...

  8. Codeforces Gym 100531G Grave 水题

    Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...

  9. 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 ...

随机推荐

  1. PHP 使用 Swoole - TaskWorker 实现异步操作 Mysql

    在一般的 Server 程序中都会有一些耗时的任务,比如:发送邮件.聊天服务器发送广播等.如果我们采用同步阻塞的防水去执行这些任务,那么这肯定会非常的慢. Swoole 的 TaskWorker 进程 ...

  2. js 判断是否滚动到底部

    $(window).scroll(function(){ var scrollTop = $(this).scrollTop(); //scrollTop() 方法返回或设置匹配元素的滚动条的垂直位置 ...

  3. POJ 2739 Sum of Consecutive Prime Numbers(素数)

    POJ 2739 Sum of Consecutive Prime Numbers(素数) http://poj.org/problem? id=2739 题意: 给你一个10000以内的自然数X.然 ...

  4. [ACM] hdu 4248 A Famous Stone Collector (DP+组合)

    A Famous Stone Collector Problem Description Mr. B loves to play with colorful stones. There are n c ...

  5. php中file_get_contents如何读取大容量文件

    php中file_get_contents如何读取大容量文件 一.总结 一句话总结:使用file_get_contents()进行分段读取,file_get_contents()函数可以分段读取 1. ...

  6. spring boot整合mail

    1.添加依赖 </dependency> <dependency> <groupId>org.springframework.boot</groupId> ...

  7. P3227 [HNOI2013]切糕

    题目描述 经过千辛万苦小 A 得到了一块切糕,切糕的形状是长方体,小 A 打算拦腰将切糕切成两半分给小 B.出于美观考虑,小 A 希望切面能尽量光滑且和谐.于是她找到你,希望你能帮她找出最好的切割方案 ...

  8. 虚拟主机TOMCAT配置

    在tomcat中添加虚拟主机: 编辑"tomcat\conf\server.xml",在"<Engine></Engine>"元素中新加 ...

  9. 认识javascript的引擎之--1

    前言: 一:每一款浏览器里面都能执行js脚本,那是因为制造商在浏览器里面加入了js引擎.也就是说js引擎在浏览器里面占有一席之地. 1.开始的时候js处于沉睡状态,直到运行页面遇到 <scrip ...

  10. Java SpringMvc Jar包下载及部署方式_转载

    本次来记录一下关于 springmvc jar包的下载以及部署 首先登陆   http://repo.spring.io/release/org/springframework/spring/到里面我 ...