FACTCG - Easy 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^5) .


Output

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


Sample Input

1

2

4

8

Sample 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
2020-08-20 22:39:20
@phyllipe there is something strange about this question. I already answered the harder FACTCG2 but submitted a different and simpler code for this. It got wrong answer so I submitted the other code which was accepted. Now, my own test case contains every input in the stated range, and my two codes produce identical output under test. So why did the first one fail here?

Last edit: 2020-08-20 22:42:02
2018-02-25 19:19:18
what the heck !! u idiot
why can't u change " x"to " x ".. costed me 3 WA
2016-01-15 15:27:05
@Phyllipe medeiros please correct output statement " x" to " x " .
2016-01-15 15:25:42
sieve works fine 0.22 seconds .
2015-02-01 12:47:58 Rishabh
Just see ur spaces.cost me 2 WA
2015-01-13 10:10:48 Somil Gupta
Thanks for the strict time limit... found a new technique altogether :)
2012-06-21 16:45:25 jaans
@Phyllipe --> the tutorial version helped me a lot to bring down my time limit :)) thanks for the tutorial version :)great work !!!
2012-04-20 03:44:45 Ahmed AKram
can you please tell me where my algorithm fails ?
ID 6876204
2012-02-27 01:54:20 [Retired] Fendy Kosnatha
yeah, i using sherman lehman algorithm in this problem..
2012-02-27 01:43:54 Phyllipe Medeiros
Thanks Mitch! I was thinking in move this to tutorial too, thank you for your opinion! Fendy there are a lot of queries, but a simple sqrt solution is enough. Maybe you should try to not use cin/cout.

Last edit: 2012-02-27 01:47:53
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.