题目链接: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. oracle 在分区内查询数据

    查看当前分区 select t.partition_name,t.num_rows from all_tab_partitions t where table_name='table_name' 单个 ...

  2. 【HDU 2089】不要62

    http://acm.hdu.edu.cn/showproblem.php?pid=2089 数位dp,参照了打野的博客 预处理出f数组,f[i][j]表示第i位为数字j时的可行的数字总数. 对于区间 ...

  3. 【BZOJ 4518】【SDOI 2016 Round1 Day2 T3】征途

    比较明显的斜率优化DP,省选时因为时间太紧张和斜率DP写得不熟等原因只写了60分的暴力DP,其实当时完全可以对拍来检验标算的正确,但是我当时too naive- 很快打完了,调了将近一晚上QAQ,因为 ...

  4. Input checkbox 添加样式背景

    <style type="text/css"> .chk_1 { width: 20px; height: 20px; position: absolute; top: ...

  5. jQuery 图片等比缩放

    $(function(){ $('.img-box img').load(function(){ var w = $(this).width(); var h =$(this).height(); i ...

  6. 让webstorm支持avalon语法自动补全

    在file菜单下选择Settings,选择Editor ——> Inspections ——> Html ——> Unknown HTML tag attibute添加以下标签ms- ...

  7. Leetcode 132. Palindrome Partitioning II

    求次数的问题一般用DP class Solution(object): def minCut(self, s): """ :type s: str :rtype: int ...

  8. HDU1269 迷宫城堡

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000作者博客:http://www.cnblogs.com/ljh2000-jump/转 ...

  9. XCode显示iOS Simulators时不显示系统版本号并出现Identifier(UUID)

    如果出现如下的显示问题,说明你添加了多个相同系统版本的iOS Simulators: 打开Windows->Devices,查看已经出现了相同版本的模拟器: 那么我们删除一些相同的模拟器,即可解 ...

  10. TYVJ1427 小白逛公园

    时间: 1000ms / 空间: 131072KiB / Java类名: Main 描述     小新经常陪小白去公园玩,也就是所谓的遛狗啦…在小新家附近有一条“公园路”,路的一边从南到北依次排着n个 ...