Submit | All submissions | Best solutions | Back to list |
ROOT - Root of a Linear Equation |
Given two nonnegative integers a and b, you are to generate the solution of the equation b*x=a.
Input
The number of test cases is given in the very first line. For each test case there is a single line containing two integers a and b without any leading zeroes, separated by a single space.
Tip: For more than 95% of test cases, int in C/C++/Java or longint in Pascal is enough.
The input file is about 1.4 KB.
Output
For each test case, output a single line containing the root in decimal cyclic notations, or "Invalid Input!!!"(without quotes) if the solution is not unique or the solution doesn't exist. See the example for more details.
The output file is about 1.3MB.
Example
Input: 8 1 1 1 2 1 3 1 4 1 6 24 2 15 7 1 89 Output: 1.0 0.5 0.(3) 0.25 0.1(6) 12.0 2.(142857) 0.(01123595505617977528089887640449438202247191)
Added by: | Fudan University Problem Setters |
Date: | 2007-12-01 |
Time limit: | 5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: C99 ERL JS-RHINO |
Resource: | UVA 942; USACO 79; test data by Blue Mary |