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.


The input consists of several lines.

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


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



1 x 2
1 x 2 x 2
1 x 2 x 2 x 2

hide comments
aditya_rev: 2017-05-16 02:28:12

dont know why im getting wa, can someone tell me one case?

anurag_tangri: 2017-04-03 19:01:34

learnt a lot ! unlimited TLES and then AC!

Praveen Kulkarni: 2017-03-19 04:36:58

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?

shahzada: 2017-03-01 15:17:42

so many optimizations.

aditya930: 2017-02-02 22:17:10

nice problem....use sieve....!!!!

sandeepg97: 2016-12-10 12:27:34

@yash Sharma...you made my day!!!

((actually couple of days :p)) ...thanks!

sushantoberoi3: 2016-08-25 18:16:54

use printf/scanf...cin/cout-> tle

ritik_001: 2016-08-09 15:11:23

AC after 6 WA(s).. that extra space costed me a lot. ;(

aspro: 2016-06-02 14:15:11

very good question .... optimise the sieve as much as possible...

shikhar0037: 2016-01-27 16:06:25

use scanf and printf .Also print solution in ascending order only.

Added by:Phyllipe Medeiros
Time limit:0.517s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64