Submit | All submissions | Best solutions | Back to list |
CERI2018I - Check factorization |
Your friend build a fantastic factoring algorithm, and challenge you to check his results.
Assume that number , where are prime numbers, and are positive integers.
You will be given a prime factorization of , you'll have to print .
Input
The first line of the input consist of a single integer number t which determines the number of tests.
Each test is on 2 separate lines.
In each test,
- on the first line, there is two integer numbers , and .
- on the second line, there is integer numbers and , with a prime number.
Constraints
- ;
- ;
- ;
- , a prime number ;
- .
Output
For each test case, print .
Example
Input: 3 0 1000 17,1 2 100 2,1 5,1 7,2 1 1000 3,1 1000000007,1 Output: 17 90 21
Explanation
For the first test case, , and .
For the second test case, , and .
For the third test case, , and .
Added by: | Francky |
Date: | 2018-05-08 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
hide comments
2020-03-09 22:05:05
Francky, I've put my email in my CPP solution source here because yours is nowhere to be found ;) =Get it= ;) Last edit: 2020-03-10 10:45:40 |
|
2018-05-08 08:35:25 [Rampage] Blue.Mary
Please check the input file. At least one test case (including sample given above) doesn't satiesfy "the second line contains 2(k+1) integers". =(Francky)=> Done, many thanks for your catch. Last edit: 2018-05-08 10:57:54 |