ACM_0119 - FAST SOLVER
In this problem you are given six simple equations. You are also informed that correct values of x1, x2, x3, x5, x6, x7, are in the answer set A = {a1, a2, a3,…,an} for some integer n, where each ai is in the set of prime numbers between 2 to 20,000,000. The six equations are as follows.
c_{1} = x_{1}x_{2}
x_{4} = c_{4}x_{1}
c_{3} = x_{6}x_{7}
x_{8} = x_{7}c_{2}
c_{5} = x_{2}x_{3}
c_{6} = x_{6}x_{5}
Observe that c1, c2, c3, c4, c5, and c6 are positive integer constants at most (20,000,000)2. Given c1, c2, c3, c4, c5, and c6, your job is to find an efficient algorithm to solve these equations and report the correct values of x1, x2, x3, x5, x6, x7. You can be sure that these equations can be solved.
Input
The input file contains 6 integers separated by a blank representing c1, c2, c3, c4, c5, and c6, respectively.
Output
The output file has a single line reporting the correct values of x1, x2, x3, x5, x6, x7, respectively. Each value is separated by a blank. (In case there are many possible solutions, choose only one of them as the output.)
Examples
№ |
stdin |
stdout |
1 |
6 20 35 10 39 77 |
2 3 13 11 7 5 |
Added by: | Հրանտ Հովհաննիսյան |
Date: | 2014-02-02 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Thailand Central Group A 2013.D |