<PREV Problem:
NEXT>
Solved by 95 users: ...
UserDateAttemptTimeCMSC
ripatti28 may 2011C++1200.20671 
zmy21 dec 2007C++100.03749 
mishik30 sep 2007C++400.02788 
tomek20 feb 2006C++101.01790 
mishik30 sep 2007C++200.02795 
LiuChenheng12 oct 2011C++100.02824 
tnndye24 may 2007FPC100.06870 
Pupyrev07 aug 2004C++1?.??870 
RAVEman30 dec 2008C++300.23890 
mishik29 sep 2007C++100.02893 
ripatti28 may 2011C++1000.20897 
FordPerfect18 feb 2010C++100.02920 
DAV15 feb 2010C++1100.08920 
Languages
C++
59
C
16
FPC
11
Kylix
7
Java
3
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

Chess end-game

Time limit = 3 seconds

Chess. We have free figures on the board. White: King, Queen. Black: King. White King is on c3 and should not move.

Black King is trying to survive as long as possible. Given White Queen and Black King positions you should find minimal number of moves until checkmate.

Input In the first line the posision of White Queen is given. In the second — the position of Black King. The situation in input is correct, i.e. all figures have different positions and and whites could not kill Black King next move.

Input#1
f2 
c1
Output#1
1
Input#2
f2 
a1
Output#2
1
Input#3
f4
a1
Output#3
2
Input#4
h3
a5
Output#4
6

Author:
folklor
6 September 2003

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 190ms

SW soft NIX
ID = 18.232.55.175