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.

Input

The input consists of several lines.

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

Output

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

Sample

Input
1
2
4
8

Output
1
1 x 2
1 x 2 x 2
1 x 2 x 2 x 2

hide comments
Diogo Soares [UFAM]: 2013-01-23 03:12:35

Is there any ideal strategy to pass this question in less than 10 seconds. O(n) takes > 10 s with optmization

DivineAtheist: 2013-01-20 02:20:41

Finally got AC...Now i wonder how people got AC in just 2.03 seconds...Even polard rho is giving TLE here...

Last edit: 2013-01-20 02:21:53
!!AV!!: 2013-01-19 20:13:01

clears the concept of prime factorization..!!

:-P: 2012-11-09 11:04:31

please correct the problem in the description it says “ x” but in the example it's “ x ”
I'm getting wa not tle

Last edit: 2012-11-09 11:11:03
gourav: 2012-10-06 07:17:07

yipeee! 16th problem ;)

bhavneet: 2012-10-01 07:00:47

can anybody xplain me format of output
is this like this 1<space><small x><space>2

gourav: 2012-10-01 06:41:22

i am not why i am getting WA problem. it is giving correct o/p for 1 , 10000000 and may others which i can think of. there is no problem according to me. TLE can't be there. :'(
Edit:code link removed by saurabh8c please see notes before posting comments

Last edit: 2012-12-19 03:51:21
Pankaj Jindal: 2012-08-16 19:24:03

Abhishek Mishra: Removing the extra spaces at the end of your output gives TLE

ARPIT BHARDWAJ: 2012-08-11 06:31:56

can anyone please give some nice test cases?? getting wa continuously..

devu: 2012-08-01 17:47:42

huhh!!! finally accepted !! nice problem :)


Added by:Phyllipe Medeiros
Date:2012-02-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64