问题描述
题目链接:http://codeforces.com/problemset/problem/710/A
思路
大意求输入的棋盘位置有几个相邻的位置。一看题目。。。直接用常量数组存下相关数据。。。然后就过了?!
代码
#include <iostream>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <cstdlib>
using namespace std;
int a[8][8]={3,5,5,5,5,5,5,3,
5,8,8,8,8,8,8,5,
5,8,8,8,8,8,8,5,
5,8,8,8,8,8,8,5,
5,8,8,8,8,8,8,5,
5,8,8,8,8,8,8,5,
5,8,8,8,8,8,8,5,
3,5,5,5,5,5,5,3,};
int main()
{
char c,d;
cin>>c>>d;
cout<<a[d-'1'][c-'a']<<endl;
return 0;
}