- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
#include <bits/stdc++.h>
using namespace std;
int main(){
int x1,y1,x2,y2;
string xy1,xy2;
cin>>xy1>>xy2;
if (xy1[0]=='A')x1=1;
if (xy1[0]=='B')x1=2;
if (xy1[0]=='C')x1=3;
if (xy1[0]=='D')x1=4;
if (xy1[0]=='E')x1=5;
if (xy1[0]=='F')x1=6;
if (xy1[0]=='G')x1=7;
if (xy1[0]=='H')x1=8;
if (xy1[1]=='1')y1=1;
if (xy1[1]=='2')y1=2;
if (xy1[1]=='3')y1=3;
if (xy1[1]=='4')y1=4;
if (xy1[1]=='5')y1=5;
if (xy1[1]=='6')y1=6;
if (xy1[1]=='7')y1=7;
if (xy1[1]=='8')y1=8;
if (xy2[0]=='A')x2=1;
if (xy2[0]=='B')x2=2;
if (xy2[0]=='C')x2=3;
if (xy2[0]=='D')x2=4;
if (xy2[0]=='E')x2=5;
if (xy2[0]=='F')x2=6;
if (xy2[0]=='G')x2=7;
if (xy2[0]=='H')x2=8;
if (xy2[1]=='1')y2=1;
if (xy2[1]=='2')y2=2;
if (xy2[1]=='3')y2=3;
if (xy2[1]=='4')y2=4;
if (xy2[1]=='5')y2=5;
if (xy2[1]=='6')y2=6;
if (xy2[1]=='7')y2=7;
if (xy2[1]=='8')y2=8;
if ((abs(x1-x2)==1&&abs(y1-y2)==0)||
(abs(x1-x2)==0&&abs(y1-y2)==1)||
(abs(x1-x2)==1&&abs(y1-y2)==1)||
(y1==y2||x1==x2||abs(x1-x2)==abs(y2-y1))||
(y1==y2||x1==x2)||
(abs(x1-x2)==abs(y2-y1))||
(abs(x1-x2)==1&&abs(y1-y2)==2)||
(abs(x1-x2)==2&&abs(y1-y2)==1)||
(x1==x2&&((y1==2&&y2==y1+2)||(y1>=2&&y2==y1+1))))
{
//king
if(abs(x1-x2)==1&&abs(y1-y2)==0)
cout<<"King\n";
else if(abs(x1-x2)==0&&abs(y1-y2)==1)
cout<<"King\n";
else if(abs(x1-x2)==1&&abs(y1-y2)==1)
cout<<"King\n";
//queen
if(y1==y2||x1==x2||abs(x1-x2)==abs(y2-y1))
cout<<"Queen\n";
//rook
if(y1==y2||x1==x2)
cout<<"Rook\n";
//bishop
if (abs(x1-x2)==abs(y2-y1))
cout<<"Bishop\n";
//knight
if(abs(x1-x2)==1&&abs(y1-y2)==2)
cout<<"Knight\n";
else if(abs(x1-x2)==2&&abs(y1-y2)==1)
cout<<"Knight\n";
//pawn
if(x1==x2&&((y1==2&&y2==y1+2)||(y1>=2&&y2==y1+1)))
cout<<"Pawn\n";
}
else cout<<"Nobody";
}
vistefan 13.09.2018 10:35 # +1
Steve_Brown 13.09.2018 10:57 # 0
guest8 13.09.2018 11:06 # −999
4e1 13.09.2018 12:21 # 0
сразу олимпиадника видно
MasterJoda 13.09.2018 11:37 # 0