

Consecutive DigitsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 176 Accepted Submission(s): 101 Problem Description As a recruiting ploy, Google once posted billboards in Harvard Square and in the Silicon Valley area just stating ¡°{first 10digit prime found in consecutive digits of e}.com¡±. In other words, find that 10digit sequence and then connect to the web site¡ª and find out that Google is trying to hire people who can solve a particular kind of problem. Not to be outdone, Gaggle (a loosygoosy fuzzy logic search firm), has devised its own recruiting problem. Consider the base 7 expansion of a rational number. For example, the first few digits of the base 7 expansion of 1/5_{10} = 0.12541..._{7},33/4_{10} = 11.15151..._{7}, and 6/49_{10} = 0.06000..._{7}, From this expansion, find the digits in a particular range of positions to the right of the "decimal" point. Input The input file begins with a line containing a single integer specifying the number of problem sets in the file. Each problem set is specified by four base 10 numbers on a single line, n d b e, where n and d are the numerator and denominator of the rational number and 0 ¡Ü n ¡Ü 5,000 and 1 ¡Ü d ¡Ü 5,000. b and e are the beginning and ending positions for the desired range of digits, with 0 ¡Ü b,e ¡Ü 250 and 0 ¡Ü (eb) ¡Ü 20. Note that 0 is the position immediately to the right of the decimal point. Output Each problem set will be numbered (beginning at one) and will generate a single line: Problem k: n / d, base 7 digits b through e: result where k is replaced by the problem set number, result is your computed result, and the other values are the corresponding input values. Sample Input
Sample Output
Source Recommend zty  
