{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e \u003cspan\u003e\u003ca href\u003d\"http://uva.onlinejudge.org/external/109/10920.pdf\"\u003e\u003cimg alt\u003d\"Download as PDF\" height\u003d\"26\" src\u003d\"http://uva.onlinejudge.org/components/com_onlinejudge/images/button_pdf.png\" title\u003d\"Download as PDF\" width\u003d\"100\"\u003e\u003c/a\u003e\u003c/span\u003e\u003c/p\u003e \n\u003cdiv\u003e\n \u0026nbsp;\n\u003c/div\u003e \n\u003cp\u003e Problem E - Magic Tap\u003c/p\u003e \n\u003ch1\u003e Problem E - Magic Tap\u003c/h1\u003e \n\u003ch3\u003e Time Limit: 1 second\u003c/h3\u003e \n\u003cdiv\u003e\n \u0026nbsp;\n\u003c/div\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003cp\u003e The game of Magic Tap is played on a square grid. Pieces are placed on a grid and the moves are realized according to the position of the pieces on the grid. However, the coordinate system in the game of Magic Tap are a bit different that those find in traditional board games.\u003c/p\u003e \n\u003cp\u003e The cell numbering scheme follow a spiral, starting from the center of the grid in an anti-clockwise fashion. The following figure illustrates the cell numbering scheme.\u003c/p\u003e \n\u003cp\u003e \u003cimg src\u003d\"http://uva.onlinejudge.org/external/109/p10920.png\"\u003e\u003c/p\u003e \n\u003cp\u003e The goal is, given the magic tap coordinates of a cell, find its \u003cspan\u003e\u003cspan\u003ecartesian\u003c/span\u003e\u003c/span\u003e coordinates (line \u003cb\u003e1\u003c/b\u003e is at the bottom, and column \u003cb\u003e1\u003c/b\u003e is the leftmost).\u003c/p\u003e \n\u003ch2\u003e Input\u003c/h2\u003e \n\u003cp\u003e The input is a series of lines. Each line is composed of two numbers: \u003cb\u003e\u003cspan\u003e\u003cspan\u003eSZ\u003c/span\u003e\u003c/span\u003e\u003c/b\u003e and \u003cb\u003eP\u003c/b\u003e. \u003cb\u003e\u003cspan\u003e\u003cspan\u003eSZ\u003c/span\u003e\u003c/span\u003e\u003c/b\u003e is the size of the border of the grid and is an odd number no larger than \u003cb\u003e100000\u003c/b\u003e. \u003cb\u003eP\u003c/b\u003e is the spiral position of a cell in this grid. The line such that \u003cb\u003e\u003cspan\u003e\u003cspan\u003eSZ\u003c/span\u003e\u003c/span\u003e \u003d P \u003d 0\u003c/b\u003e marks the end of the input (and is not part of the data set).\u003c/p\u003e \n\u003ch2\u003e Output\u003c/h2\u003e \n\u003cp\u003e For each line in the data set of the input, your program must echo a line \u003cb\u003e\"Line \u003d X, column \u003d Y.\"\u003c/b\u003e, where \u003cb\u003eX\u003c/b\u003e and \u003cb\u003eY\u003c/b\u003e are the \u003cspan\u003e\u003cspan\u003ecartesian\u003c/span\u003e\u003c/span\u003e coordinates of the corresponding cell.\u003c/p\u003e \n\u003ch2\u003e Sample Input\u003c/h2\u003e \n\u003cpre\u003e\r\n3 1\r\n3 3\r\n3 9\r\n5 9\r\n5 10\r\n0 0\r\n\u003c/pre\u003e \n\u003ch2\u003e Sample Output\u003c/h2\u003e \n\u003cpre\u003e\r\nLine \u003d 2, column \u003d 2.\r\nLine \u003d 3, column \u003d 1.\r\nLine \u003d 3, column \u003d 3.\r\nLine \u003d 4, column \u003d 4.\r\nLine \u003d 5, column \u003d 4.\r\n\u003c/pre\u003e \n\u003cp\u003e \u003ci\u003eProblem setter: David \u003cspan\u003eDeharbe\u003c/span\u003e, Copyright 2005 \u003cspan\u003eUFRN\u003c/span\u003e. All rights reserved.\u003c/i\u003e\u003c/p\u003e"}}]}