PTIME - Prime Time
For your math homework this week your teacher gave you five large numbers and asked you to find their prime factors. However these numbers aren't nearly large enough for someone with knowledge of programming like yourself. So you decide to take the factorial of each of these numbers. Recall that N! (N factorial) is the product of the integers from 1 through N (inclusive). It’s your job now to create a program to help you do your homework.
Input
Each test case contains a number N (2 ≤ N ≤ 10000).
Output
The output should contain a line representing the prime factorization of the factorial given number, which should be of the form: p1^e1 * p2^e2 * ... * pk^ek where p1, p2, ... pk are the distinct prime factors of the factorial of the given number in increasing order, and e1, e2, ... ek are their exponents.
Example
Input: 10 Output: 2^8 * 3^4 * 5^2 * 7^1
hide comments
Snehasish Roy ;):
2012-07-15 10:00:04
there are many problems of this type..
|
|
Aditya Pande:
2012-07-11 09:51:16
plz tell me why submission ID 7297845 got WA
|
|
saket diwakar:
2012-07-03 18:16:50
enjoyed to code it...:) Last edit: 2012-07-03 18:21:35 |
|
Amlesh Jayakumar:
2012-06-24 04:22:37
@Saurabh- As mentioned in the problem, all test cases contain a value N that is <= 10^4. |
|
Saurabh Jain:
2012-06-23 07:33:14
@Amlesh: the value of n is greater than 10^4..you should have corrected it..cost me 5 WAs !! |
|
Mitch Schwartz:
2012-06-23 01:16:08
@Amlesh: Your response doesn't make sense, but I'll drop it. People can always read comments or guess about input format. |
|
Amlesh Jayakumar:
2012-06-22 20:48:54
@Mitch- Seeing as there are AC solutions that don't input until EOF, I'll keep the problem as is for now.
|
|
napster:
2012-06-22 07:37:56
AC,no need to check for EOF.
|
|
Mitch Schwartz:
2012-06-22 01:53:32
Writing "while (std::cin >> foo)" is just a different way to read until End Of File.
|
|
Amlesh Jayakumar:
2012-06-21 23:18:23
There's only one N per testcase as indicated. I'm not sure why you need to read till eof (my program didn't and AC'd).
|
Added by: | Amlesh Jayakumar |
Date: | 2012-06-19 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | DWITE Programming Contest 2012 (Own Problem) |