FACTCG2 - Medium Factorization

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

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

hide comments
2013-01-23 03:12:35 Diogo Soares [UFAM]
Is there any ideal strategy to pass this question in less than 10 seconds. O(n) takes > 10 s with optmization
2013-01-20 02:20:41 DivineAtheist
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
2013-01-19 20:13:01 !!AV!!
clears the concept of prime factorization..!!
2012-11-09 11:04:31 :-P
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
2012-10-06 07:17:07 gourav
yipeee! 16th problem ;)
2012-10-01 07:00:47 bhavneet
can anybody xplain me format of output
is this like this 1<space><small x><space>2
2012-10-01 06:41:22 gourav
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
2012-08-16 19:24:03 Pankaj Jindal
Abhishek Mishra: Removing the extra spaces at the end of your output gives TLE
2012-08-11 06:31:56 ARPIT BHARDWAJ
can anyone please give some nice test cases?? getting wa continuously..
2012-08-01 17:47:42 devu
huhh!!! finally accepted !! nice problem :)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.