//-------------------------------------------------------------- //UVA 10849 - Move the Bishop // //Version: Submission //Author: Andrew P //Date: September 2012 //-------------------------------------------------------------- #include <stdio.h> //IO #include <cmath> //for absval #define DEBUG if(false) using namespace std; int main() { int numCases; scanf ("%d", &numCases); while (numCases--) { int numTestsInCase; int gridSize; scanf ("%d", &numTestsInCase); scanf ("%d", &gridSize); while (numTestsInCase--) { int coords[4]; bool noMove = 0; for (int i = 0; i < 4; i++) { scanf ("%d", &coords[i]); if (coords[i] > gridSize || coords[i] < 1) noMove = 1; } if (noMove) printf ("no move\n"); else { int bishop = abs(coords[0] - coords[2]); int goal = abs(coords[1] - coords[3]); if (coords[0] == coords[2] && coords[1] == coords[3]) printf("0\n"); else if (bishop == goal) printf("1\n"); else if (bishop % 2 == 0 && goal % 2 == 0) printf("2\n"); else if (bishop % 2 == 1 && goal % 2 == 1) printf("2\n"); else printf ("no move\n"); } } } return 0; }The statements and opinions included in these pages are those of only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Isaac Traxler