FACTCG - Easy 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^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


hide comments
weathervane: 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
ab_biswas09: 2018-02-25 19:19:18

what the heck !! u idiot
why can't u change " x"to " x ".. costed me 3 WA

darkhire21: 2016-01-15 15:27:05

@Phyllipe medeiros please correct output statement " x" to " x " .

darkhire21: 2016-01-15 15:25:42

sieve works fine 0.22 seconds .

Rishabh: 2015-02-01 12:47:58

Just see ur spaces.cost me 2 WA

Somil Gupta: 2015-01-13 10:10:48

Thanks for the strict time limit... found a new technique altogether :)

jaans: 2012-06-21 16:45:25

@Phyllipe --> the tutorial version helped me a lot to bring down my time limit :)) thanks for the tutorial version :)great work !!!

Ahmed AKram: 2012-04-20 03:44:45

can you please tell me where my algorithm fails ?
ID 6876204

[Retired] Fendy Kosnatha: 2012-02-27 01:54:20

yeah, i using sherman lehman algorithm in this problem..

Phyllipe Medeiros: 2012-02-27 01:43:54

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

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