CodeForces 710A King Moves

时间:2021-02-28 03:46:36

简单题。

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-; char s[],R,C,ans; bool check(int a,int b)
{
if(a>=&&a<=&&b>=&&b<=) return ;
return ;
}
int main()
{
scanf("%s",s);
R=s[]-''; C=s[]-'a'+;
ans=; if(check(R-,C-)) ans++;
if(check(R-,C)) ans++;
if(check(R-,C+)) ans++;
if(check(R,C-)) ans++;
if(check(R,C+)) ans++;
if(check(R+,C-)) ans++;
if(check(R+,C)) ans++;
if(check(R+,C+)) ans++; printf("%d\n",ans);
return ;
}