题目链接: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. android 之fragment创建

    1.使用xml标签 1.1定义两个重要属性  <fragment         android:id="@+id/fregment_top"        android: ...

  2. OkHttp 3.4入门

    OkHttp 3.4入门 配置方法 (一)导入Jar包http://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp/3.4.0-RC1/okhtt ...

  3. svn 的备份还原

    备份脚本如下: #!/bin/bash ############################################################################### ...

  4. iOS开发中的错误整理,iOS9之后的UIWindow(TopWindow)以及UIWindow与statusBar的关系

    iOS9之后的UIWindow的问题(TopWindow),以及UIWindow与statusBar之间的联系 1.出现的问题 iOS9之后UIWindow必须要指定一个根控制器,不然会报错!iOS9 ...

  5. Shell命令_文件系统常用命令df、du

    一.df(文件系统查看命令) [root@localhost ~]# df [选项] [挂载点] 选项: -a 显示所有的文件系统信息,包括特殊文件系统,如 /proc. /sysfs -h 使用习惯 ...

  6. 【BZOJ 1178】【APIO 2009】CONVENTION会议中心

    http://www.lydsy.com/JudgeOnline/problem.php?id=1178 这道题想了好久没想明白,倍增数组通过看题解很快就明白了,但是一小段区间内应有的最多线段数一直不 ...

  7. HttpHelper类

    using System;using System.Collections.Generic;using System.Text;using System.Net;using System.IO;usi ...

  8. 匿名内部类为什么访问外部类局部变量必须是final的?

    1.内部类里面使用外部类的局部变量时,其实就是内部类的对象在使用它,内部类对象生命周期中都可能调用它,而内部类试图访问外部方法中的局部变量时,外部方法的局部变量很可能已经不存在了,那么就得延续其生命, ...

  9. Hive UDF开发实例学习

    1. 本地环境配置 必须包含的一些包. http://blog.csdn.net/azhao_dn/article/details/6981115 2. 去重UDF实例 http://blog.csd ...

  10. css-文本超出后显示省略号

    1.如果是单行文本: overflow: hidden; text-overflow: ellipsis; white-space: nowrap; 2.如果是多行文本,将文本框高度设为文字行高的倍数 ...