SITB - Funny Prime Factorization

Problem Description: You will given an integer number N. Find out the prime factors of this number.

Input

The input consists of several lines.

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

Output

In each line you need to print the factors of N separated by "x".

Example

Input:
2
8
6

Output:
2 = 2
8 = 2 x 2 x 2
6 = 2 x 3

Added by:Bappy
Date:2019-10-14
Time limit:0.170s-0.259s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All

hide comments
2023-06-12 18:44:29
If you get TLE try using int array instead of vector for the sieve and select compiler cpp14( c++ clang ). Also try to optimize the sieve and use printf scanf instead of cin and cout. This helped me to get out of the TLE hell. Hope this will help you too.
2023-01-08 20:12:39
is there ANY algorithm that may not exceed time limit in C#?
2022-06-29 13:11:07
I got AC in FACTCG2, but still TLE here
2022-06-29 12:16:20
seems difficult to solve TLE
2022-05-16 17:49:00 Ishan
I tried multiple approaches and got TLE . Finally I got AC. But if I have to go by the tags I didn't solve the way problem setter has solved.
2021-07-12 19:21:06 Dune
Same problem as FACTCG2
2020-08-04 19:39:05
Quite difficult to get the right algorithm as the maximum number of lines in the input is not given.

Last edit: 2020-08-11 12:28:31
2020-07-01 09:43:22
plz check my code.. it's really hard to find out why i'm getting tle !!
2020-06-22 20:07:40
Try it, It is really funny.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.