Advertisement blocking software were detected ;( Please add this webpage to whitelist.

FACTCG2 - Medium Factorization

no tags 

The task in this problem is to write a number in a multiplication of prime numbers separated by “ x”. You need to put the

number 1 in this multiplication.


The input consists of several lines.

Each line consists of one integer N (1 <= N <= 10^7) .


For each line you need to output the factorization separated by “ x” and including 1.

Sample Input





Sample Output

1 x 2
1 x 2 x 2
1 x 2 x 2 x 2

hide comments
Ashwani Gautam: 2015-10-28 19:05:38

Do not print "X" print "x" as written, and there is a space between every character.Solution look like this
"1 x 2 x 2" for 4.
and do anyone how to do this in python?

Last edit: 2015-10-29 09:05:11
Dushyant Singh: 2015-07-31 06:20:34

Nice problem. The real challenge would be to do it in python!

i_am_looser: 2015-06-09 13:07:32

lots of wrong answer because of X instead of x.

Aadil Ahmad: 2015-04-10 20:22:34

Can someone please provide me some test cases, I am getting wrong answer :(

Shounak Chatterjee: 2015-03-06 05:56:08

how many test case we should take??

Ankur Singh: 2015-03-04 05:21:19

take care of output format : print " x " instead of "x".

Madhav: 2015-02-11 13:54:00

good question..Learnt a new way of factorization.

Pranye Mawai: 2015-02-04 12:42:36

minimize the use of long long ... may lead to tle..

Jumpy: 2015-01-18 17:36:40

After, So Many Tries Got AC.
Things to be kept in mind before solving the problem , is not to use too many looping while dividing the number with desirable prime number and afterwards keep on looking for next correct prime number. I think the input file is having large number of data. So, It is better to keep it as simple as possible.

Last edit: 2015-01-18 17:43:18
computer science: 2015-01-12 02:17:48

what is number of lines ?

re(vamsi): read till EOF. check the documentation of your language if you don't know how to read till EOF

But if you are c/c++ folk, then this might be helpful
while(scanf("%i",&n) != EOF ) {

Last edit: 2015-01-18 17:40:55

Added by:Phyllipe Medeiros
Time limit:0.517s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel Pentium G860 3GHz)