FACT0 - Integer Factorization (15 digits)
This is a problem to test the robustness of your Integer Factorization algorithm.
Given some integers, you need to factor them into product of prime numbers.
The largest integer given in the input file has 15 digits. FACT1 is a harder version of this problem (the numbers are larger).
You may need to use a general factorization algorithm since no special numbers (e.g. Fermat numbers) are considered when designing the input data.
There are several numbers given, each one in a line.
The input ends with a number 0.
The number of test cases is about 10.
For each number, print in a line the factorization of it. See examples below for the output format.
Input: 3111989 13091989 77145199750673 0 Output: 317^1 9817^1 17^2 89^1 509^1 328439^1 234884407^1
$Does latext work in spoj$Last edit: 2022-05-29 20:44:07
Nice observation for the question->
TLE will come for overflow!!!
for those who use sieve, just take the size of array 3 * (10^7) then you get an ac.
Spoj will give you TLE if integer overflow occurs.
I am getting TLE for this problem even after using sieve method in PYTHON3.
just use factorization in sqrt(n) time :)
I have tried sieve with prime integer factorization but it gives me WA, anyone suggests any issue, I've test my code on many test cases it works fine.. largest number is 999999999999999 (9 15times).
|Cluster:||Cube (Intel G860)|
|Languages:||All except: ERL NODEJS PERL6 VB.NET|