B3871题解
#include<iostream>
using namespace std;
using i64=long long;
int main()
{
i64 n;
bool first=1;
cin>>n;
for(i64 i=2;i*i<=n;i++)
{
int cnt=0;
while(n%i==0)
{
cnt++;
n/=i;
}
if(cnt)
{
if(!first)
cout<<" * ";
cout<<i;
first=0;
if(cnt>1)
cout<<'^'<<cnt;
}
}
if(n>1)
{
if(!first)
cout<<" * ";
cout<<n;
}
return 0;
}