CodeForces 710A King Moves(水题-越界问题)
题目链接: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(水题-越界问题)的更多相关文章
- CodeForces 710A King Moves (水题)
题意:给定一个坐标,问你皇后有几个方向可以走. 析:直接格举那八个方向即可. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000 ...
- codeforces 710A King Moves(水)
output standard output The only king stands on the standard chess board. You are given his position ...
- codeforces 710A A. King Moves(水题)
题目链接: A. King Moves 题意: 给出king的位置,问有几个可移动的位置; 思路: 水题,没有思路; AC代码: #include <iostream> #include ...
- 【模拟】Codeforces 710A King Moves
题目链接: http://codeforces.com/problemset/problem/710/A 题目大意: 国际象棋标准8X8棋盘,国王能往周围8个方向走.输入国王的位置,输出当前国王能往几 ...
- CodeForces 710A King Moves
简单题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #inclu ...
- Codeforces Gym 100531G Grave 水题
Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...
- codeforces 706A A. Beru-taxi(水题)
题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...
- codeforces 569B B. Inventory(水题)
题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces 489A SwapSort (水题)
A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
随机推荐
- Shell脚本编程中的几个问题
条件语句 正确的写法: if [ $1 = "-f" ] #注意这里,前后方括号和中间的内容之间必须有空格! then commands fi 错误的写法: if [$1 == & ...
- Eclipse导入 appcompat,design兼容包
从Android studio推出1.0正式版后,就一直在as上开发项目,但是最近要测试一个项目,是eclipse结构,导入as后,是各种报错信息,决定改成eclipse. 其中项目中用到了ppcom ...
- Ubuntu里的若干问题解决方案
1. Ubuntu里出现两个屏幕,并且其中一个是“未知显示器”,无法去除时,可以尝试使用该命令:sudo apt-get install bumblebee-nvidia 2.虚拟机上Ubuntu开机 ...
- [转] ServletContext 与application的异同
相同:其实servletContext和application 是一样的,就相当于一个类创建了两个不同名称的变量.在 servlet中ServletContext就是application对象.大家只 ...
- poi-处理excel的单元格日期数据
poi处理excel时,当excel没有明确指明是哪个类型的数据时,poi很可能处理单元格的日期数据时就有可能是一串数字.而使用java程序基本无法转换 以下为对poi处理日期情况一些方面的处理(不是 ...
- Freemarker 各种格式化
1.格式化日期 ${updated?string("yyyy-MM-dd HH:mm:ss")} 如果指定的变量不一定存在,可以这样: ${(dateMap.beginTime?s ...
- navigate连接MySQL报错:navigate your password has expired to log in your must change it using a client that supports
如图: 终端进入mysql: 第一次show databases的的时候,密码过期了,然后重置密码为12345,再次就可以显示了 参考连接:http://www.jb51.net/article/79 ...
- 【BZOJ-2453&2120】维护队列&数颜色 分块 + 带修莫队算法
2453: 维护队列 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 653 Solved: 283[Submit][Status][Discuss] ...
- oracle mini project
oracle pl/sql mini project 1.解一元二次方程 (x2+4x+3=0) set serveroutput on declare a number ; b number; c ...
- Jenkins用HTTP Request Plugin插件进行网站的监控(运维监控)
使用的插件: [HTTP Request Plugin] 思路: 说明:只能是网站是否正常打开,而不能是这个网站业务是否正常,如果是后者,则需要写特定的接口进行请求处理. 1.通过插件,发送GET请求 ...