oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

primefactorization Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

primefactorization.html

Problem Description

Given an integer n where 2 ≤ n < 1012, factorize it into its prime factors.

Input

A single integer, n

For 100% of the testcases, n < 1012
For 50% of the testcases, n < 106
For 30% of the testcases, n < 103

Output

On each line, output the prime factors of n in sorted order, with its power indicated. (See Sample Output)

Sample Input 1

120

Sample Output 1

2^3
3^1
5^1

Sample Input 2

331

Sample Output 2

331^1

Tags

Number Theory

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
1100101s32MBAverage
2021s32MBAverage

Judge Compile Command

g++-8 ans.cpp -o primefactorization -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.