【模拟】Codeforces 710A King Moves
题目链接:
http://codeforces.com/problemset/problem/710/A
题目大意:
国际象棋标准8X8棋盘,国王能往周围8个方向走。输入国王的位置,输出当前国王能往几个方向走。
题目思路:
【模拟】
签到题(看错题目WA了一次)。边界处理下就好。
//
//by coolxxx
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<map>
#include<memory.h>
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//#include<stdbool.h>
#include<math.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(a) ((a)>0?(a):(-(a)))
#define lowbit(a) (a&(-a))
#define sqr(a) ((a)*(a))
#define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
#define mem(a,b) memset(a,b,sizeof(a))
#define eps (1e-8)
#define J 10
#define mod 1000000007
#define MAX 0x7f7f7f7f
#define PI 3.14159265358979323
#define N 10004
using namespace std;
typedef long long LL;
int cas,cass;
int n,m,lll,ans;
char ch;
int main()
{
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
// freopen("2.txt","w",stdout);
#endif
int i,j,k;
// for(scanf("%d",&cas);cas;cas--)
// for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
// while(~scanf("%s",s+1))
// while(~scanf("%d",&n))
// {
cin>>ch>>n;
ans=;
if(ch=='a' || ch=='h')ans-=;
if(n== || n==)ans-=;
if((n== || n==) && (ch=='a' || ch=='h'))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 (水题)
题意:给定一个坐标,问你皇后有几个方向可以走. 析:直接格举那八个方向即可. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000 ...
- CodeForces 710A King Moves
简单题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #inclu ...
- 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 Round #288 (Div. 2) C. Anya and Ghosts
题目传送门 /* 贪心 + 模拟:首先,如果蜡烛的燃烧时间小于最少需要点燃的蜡烛数一定是-1(蜡烛是1秒点一支), num[g[i]]记录每个鬼访问时已点燃的蜡烛数,若不够,tmp为还需要的蜡烛数, ...
- 模拟 Codeforces Round #203 (Div. 2) C. Bombs
题目地址:http://codeforces.com/problemset/problem/350/C /* 题意:机器人上下左右走路,把其他的机器人都干掉要几步,好吧我其实没读懂题目, 看着样例猜出 ...
- 模拟 Codeforces Round #249 (Div. 2) C. Cardiogram
题目地址:http://codeforces.com/contest/435/problem/C /* 题意:给一组公式,一组数据,计算得到一系列的坐标点,画出折线图:) 模拟题:蛮恶心的,不过也简单 ...
随机推荐
- poj1742 Coins(多重背包+单调队列优化)
/* 这题卡常数.... 二进制优化或者单调队列会被卡 必须+上个特判才能过QAQ 单调队列维护之前的钱数有几个能拼出来的 循环的时候以钱数为步长 如果队列超过c[i]就说明队头的不能再用了 拿出来 ...
- webservice 发布到外网的时候
在web.config的<system.web></system.web>中间加入如下配置节内容<webServices> <protoco ...
- @PostConstruct与@PreDestroy
从Java EE 5规范开始,Servlet中增加了两个影响Servlet生命周期的注解(Annotion):@PostConstruct和@PreDestroy.这两个注解被用来修饰一个非静态的vo ...
- java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String
http://blog.csdn.net/agileclipse/article/details/17161225 详情请点击链接查看
- Alljoyn 概述(2)
AllJoyn 基本概念 • 总线(Bus) – 实现P2P通信的基础 – AllJoyn 的底层协议类似于D-Bus,相当于是跨设备分布式的 D-Bus • 总线附件(Bus Attachment) ...
- 苹果App store 2015最新审核标准公布(2015.3)
苹果近日更新了AppStore审核指南的相关章节,对此前版本进行了修改和完善.除了增加应用截图.预览等限制外,使用ApplePay进行定期付款的应用程序必须展示每个阶段所需款额,费用归属以及如何取消. ...
- java 计算器SWT/RAP(版本3)键盘鼠标兼容
java 计算器SWT/RAP(版本3)键盘鼠标兼容,之前版本也对,但存在线程失效问题,当多人访问时,就容易线程失效,一直犯得一个错误就是一直用static变量和static方法, 之前加了什么js界 ...
- SGU 165.Basketball
题意 输入n个在[1.95,2.05]范围内的数. 保证他们的平均数为2.00. 现在要求把这些数调整出一个顺序, 使得任意长度为K的子段和与2.00* ...
- nginx插件ngx_lua
ngx_lua是淘宝的维护的产品,真心不错.配置文件包含可以做很多事情的lua脚本. 公司有个产品对注册的广告盒子进行反向代理,这样可以在盒子上做很多事情:和服务器通信,远程控制盒子等等.nginx反 ...
- free 堡垒机
环境: centos6.5 mini安装 iptables selinux已经关闭 jumpserver: 192.168.1.209 testserver: 192.168.1.210 一. 部署l ...