{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eLet {\u003ci\u003ex\u003c/i\u003e} \u003d 0.\u003ci\u003ea\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e3\u003c/sub\u003e... be the binary representation of the fractional part of a rational number \u003ci\u003ez\u003c/i\u003e. Suppose that {\u003ci\u003ex\u003c/i\u003e} is periodic then, we can write\u003c/p\u003e\u003cp align\u003d\"center\"\u003e{\u003ci\u003ex\u003c/i\u003e} \u003d 0.\u003ci\u003ea\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e...\u003ci\u003ea\u003csub\u003er\u003c/sub\u003e\u003c/i\u003e(\u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003er\u003c/i\u003e+1\u003c/sub\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003er\u003c/i\u003e+2\u003c/sub\u003e...\u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003er\u003c/i\u003e+\u003ci\u003es\u003c/i\u003e\u003c/sub\u003e)\u003csup\u003e\u003ci\u003ew\u003c/i\u003e\u003c/sup\u003e\u003c/p\u003e\u003cp\u003efor some integers \u003ci\u003er\u003c/i\u003e and \u003ci\u003es\u003c/i\u003e with \u003ci\u003er\u003c/i\u003e ≥ 0 and \u003ci\u003es\u003c/i\u003e \u0026gt; 0. Also, (\u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003er\u003c/i\u003e+1\u003c/sub\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003er\u003c/i\u003e+2\u003c/sub\u003e...\u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003er\u003c/i\u003e+\u003ci\u003es\u003c/i\u003e\u003c/sub\u003e)\u003csup\u003e\u003ci\u003ew\u003c/i\u003e\u003c/sup\u003edenotes a nonterminating and repeating binary subsequence of {\u003ci\u003ex\u003c/i\u003e}.\u003c/p\u003e\u003cp\u003eThe subsequence \u003ci\u003ex\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e \u003d \u003ci\u003ea\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e ... \u003ci\u003ea\u003csub\u003er\u003c/sub\u003e\u003c/i\u003eis called the \u003ci\u003epreperiod\u003c/i\u003e of {\u003ci\u003ex\u003c/i\u003e} and \u003ci\u003ex\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e \u003d \u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003er\u003c/i\u003e+1\u003c/sub\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003er\u003c/i\u003e+2\u003c/sub\u003e ... \u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003er\u003c/i\u003e+\u003ci\u003es\u003c/i\u003e\u003c/sub\u003e is the \u003ci\u003eperiod\u003c/i\u003e of {\u003ci\u003ex\u003c/i\u003e}.\u003c/p\u003e\u003cp\u003eSuppose that |\u003ci\u003ex\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e| and |\u003ci\u003ex\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e| are chosen as small as possible then \u003ci\u003ex\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e is called the \u003ci\u003eleast preperiod\u003c/i\u003e and \u003ci\u003ex\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e is called the \u003ci\u003eleast period\u003c/i\u003e of {\u003ci\u003ex\u003c/i\u003e}.\u003c/p\u003e\u003cp\u003eFor example, \u003ci\u003ex\u003c/i\u003e \u003d 1/10 \u003d 0.0001100110011(00110011)\u003csup\u003e\u003ci\u003ew\u003c/i\u003e\u003c/sup\u003e and 0001100110011 is a preperiod and 00110011 is a period of 1/10.\u003c/p\u003e\u003cp\u003eHowever, we can write 1/10 also as 1/10 \u003d 0.0(0011)\u003csup\u003e\u003ci\u003ew\u003c/i\u003e\u003c/sup\u003e and 0 is the least preperiod and 0011 is the least period of 1/10.\u003c/p\u003e\u003cp\u003eThe least period of 1/10 starts at the 2nd bit to the right of the binary point and the the length of the least period is 4.\u003c/p\u003e\u003cp\u003eWrite a program that finds the position of the first bit of the least period and the length of the least period where the preperiod is also the minimum of a positive rational number less than 1.\u003c/p\u003e\n\n给定一个a/b,求a/b的结果变成二进制之后的小数。这个小数后面会有一段循环节,只要求输出循环节开始循环的位置和循环长度。"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eEach line is test case. It represents a rational number \u003ci\u003ep\u003c/i\u003e/\u003ci\u003eq\u003c/i\u003e where \u003ci\u003ep\u003c/i\u003e and \u003ci\u003eq\u003c/i\u003e are integers, \u003ci\u003ep \u003c/i\u003e ≥ 0 and \u003ci\u003eq\u003c/i\u003e \u0026gt; 0.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eEach line corresponds to a single test case. It represents a pair where the first number is the position of the first bit of the least period and the the second number is the length of the least period of the rational number.\u003c/p\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1/10 \n1/5 \n101/120 \n121/1472\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 2,4 \nCase #2: 1,4 \nCase #3: 4,4 \nCase #4: 7,11\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}