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
2018-03-26 06:42:47
Some testfiles contain over 300,000 integers. I think this puts to bed any hopes of getting AC with Python here.
2017-12-30 19:43:14
@Phyllipe Medeiros
can anyone solve this in java?

Last edit: 2017-12-30 19:43:50
2017-12-20 12:08:59
getting runtime error. can anyone suggest me a way?
2017-10-16 19:52:41
use " x " instead of using " x"
2017-09-21 18:56:11
@admin Need help because I am not able to submit the solution.
2017-07-02 23:38:15
use sieve...
2017-06-09 12:27:34
very poor logic :)....use scanf && printf instead of cin && cout !!
2017-05-16 02:28:12
dont know why im getting wa, can someone tell me one case?
2017-04-03 19:01:34
learnt a lot ! unlimited TLES and then AC!
2017-03-19 04:36:58 Praveen Kulkarni
I am getting runtime error (NZEC)....can any one please help how to deal with taking input in interpreted languages such as perl? When to stop taking input?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.