题目链接:http://codeforces.com/problemset/problem/710/A

题目大意:在一个棋盘中给出一个位置,判断该位置周围8个点还有几个点可以摆放棋子。

AC代码解释解法:

 #include<bits/stdc++.h>
using namespace std;
int main()
{
char c;
int x,y;
while(~scanf("%c%d",&c,&x))
{
getchar();
y=c-'a'+;
if((x==&&y==)||(x==&&y==)||(x==&&y==)||(x==&&y==))
{
printf("3\n");
}
else if((x==)||(x==)||(y==)||(y==))
{
printf("5\n");
}
else
printf("8\n");
}
return ;
}

CodeForces 710A King Moves(水题-越界问题)的更多相关文章

  1. CodeForces 710A King Moves (水题)

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

  2. codeforces 710A King Moves(水)

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

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

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

  4. 【模拟】Codeforces 710A King Moves

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

  5. CodeForces 710A King Moves

    简单题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #inclu ...

  6. Codeforces Gym 100531G Grave 水题

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

  7. codeforces 706A A. Beru-taxi(水题)

    题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...

  8. codeforces 569B B. Inventory(水题)

    题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  9. Codeforces 489A SwapSort (水题)

    A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

随机推荐

  1. tttttabs

    <div id="fil-page" class="fil-page"> <div class="fil-container&quo ...

  2. 选项卡js

    趁着公司不忙,抓紧充充电,开始可能会写的不好,但是每写一个都是一点进步,哈哈,加油 用js实现选项卡切换 1.获取元素 2.初始状态 3.通过循环清空元素状态 4.点击操作以及对应的内容切换 5.自定 ...

  3. nginx的安装

    1,,nginx的安装 为什么使用nginx我就不多说了,很优秀的,请再行google 在安装前,先安装pcre,安装zlib,安装openssl,以及一些其他包 yum install -y gcc ...

  4. Maven-常用命令

    mvn archetype:create :创建 Maven 项目 mvn compile :编译源代码 mvn deploy 发布项目 mvn test-compile :编译测试代码 mvn te ...

  5. js-新窗口打开页面

    window.open(basePath+"/web/homeIndex?code="+code); 1.超链接<a href="http://www.xxx.ne ...

  6. 【CodeForces 699B】One Bomb

    r[i],c[i]分别表示第i行有几个*,第i列有几个*. 枚举每个位置如果c[i]+r[j]-(本身是不是*)==总*数,则该位置即为答案. #include<cstdio> #incl ...

  7. mysql字段冲突报错

    check the manual that corresponds to your MySQL server version for the right syntax to use near 出现这个 ...

  8. [51nod1515]明辨是非

    Description 给$n$组操作,每组操作形式为$x\;y\;p$. 当$p=1$时,如果第$x$变量和第$y$个变量可以相等,则输出$YES$,并限制他们相等;否则输出$NO$,并忽略此次操作 ...

  9. [vijos1907][NOIP2014]飞扬的小鸟

    Description 是一款风靡一时的休闲手机游戏.玩家需要不断控制点击手机屏幕的频率来调节小鸟的飞行高度,让小鸟顺利通过画面右方的管道缝隙.如果小鸟一不小心撞到了水管或者掉在地上的话,便宣告失败. ...

  10. [NOIP2014] 提高组 洛谷P1941 飞扬的小鸟

    题目描述 Flappy Bird 是一款风靡一时的休闲手机游戏.玩家需要不断控制点击手机屏幕的频率来调节小鸟的飞行高度,让小鸟顺利通过画面右方的管道缝隙.如果小鸟一不小心撞到了水管或者掉在地上的话,便 ...