CodeForces 710A King Moves
简单题。
#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的更多相关文章
- codeforces 710A King Moves(水)
output standard output The only king stands on the standard chess board. You are given his position ...
- CodeForces 710A King Moves(水题-越界问题)
题目链接:http://codeforces.com/problemset/problem/710/A 题目大意:在一个棋盘中给出一个位置,判断该位置周围8个点还有几个点可以摆放棋子. AC代码解释解 ...
- 【模拟】Codeforces 710A King Moves
题目链接: http://codeforces.com/problemset/problem/710/A 题目大意: 国际象棋标准8X8棋盘,国王能往周围8个方向走.输入国王的位置,输出当前国王能往几 ...
- CodeForces 710A King Moves (水题)
题意:给定一个坐标,问你皇后有几个方向可以走. 析:直接格举那八个方向即可. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000 ...
- codeforces 710A A. King Moves(水题)
题目链接: A. King Moves 题意: 给出king的位置,问有几个可移动的位置; 思路: 水题,没有思路; AC代码: #include <iostream> #include ...
- [Educational Codeforces Round 16]A. King Moves
[Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...
- 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 ...
- Educational Codeforces Round 16---部分题解
710A. King Moves 给你图中一点求出它周围有几个可达的点: 除边界之外都是8个,边界处理一下即可: #include<iostream> #include<cstdio ...
- 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, ...
随机推荐
- Python Learing(一):Basic Grammar
装了python2.7,去图书馆借了python入门经典,暂且简单写下学习笔记,以供自己回忆 学习笔记(一)主要是基础语法部分: 1.python中数字以及字符串的使用; 2.输入与输出语句; 3.逻 ...
- JSON.NET基本使用
序列化一个对象 public static string ToJson( object obj) { string json = JsonConvert .SerializeObject(obj); ...
- lnmp1.0 升级php.5.4.28 后出错 Nginx 502 Bad Gateway
碰到一个很奇怪的问题,用lnmp自带的./upgrade_php.sh升级 php5.4.27正常.但升级到php5.4.28就出错,访问p.php 提示:Nginx 502 Bad Gateway. ...
- oracle数据库对date字段类型存在空值进行排序的处理方法
oracle数据库对date字段类型存在空值进行排序的处理方法 oracle 数据库,如果表中有一个字段类型为date,且该字段类型存在空值,并且需要排序, 解决方法为使用oracl ...
- 代码高亮插件推荐——SyntaxHighlighter++
SyntaxHighlighter++这个插件的最大的优点就是可以在编辑器的下方有一个输入框,里面可以输入代码,然后插入到文章中.就不用编辑文章的时候,在可视化和文本之间来回切换了.非常适合不熟悉ht ...
- JavaScript之创建对象
不定义JQuery插件,不要说会JQuery 一:导言 有些WEB开发者,会引用一个JQuery类库,然后在网页上写一写$("#"),$("."),写了几年就对 ...
- 网络负载均衡环境下wsHttpBinding+Message Security+Windows Authentication的常见异常
提高Windows Communication Foundation (WCF) 应用程序负载能力的方法之一就是通过把它们部署到负载均衡的服务器场中. 其中可以使用标准的负载均衡技术, Windows ...
- Hibernate配置XML连接数据库
一.hibernate.cfg.xml 1.配置连接Oracle <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate ...
- .NET:再论异常处理,一个真实的故事
.NET:再论异常处理,一个真实的故事 背景 关于是使用枚举或布尔类型来表示方法执行状态,还是使用异常,可以参考这里的文章:http://www.google.ee/search?q=site%3Aw ...
- python logging info -> 将服务请求记录输出
在tornado 里面这样用 看看logging.warning() , logging.info() , 我们非常想用 zdaemon , 和 logging 将对系统的所有访问转换到服务器里面,作 ...