求助
1.20s(其他点4ms)
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll n,tmp,first=1;
cin>>n;
for(int i=2;i*i<=n;i++)
{
tmp=0;
while(n%i==0)
{
tmp++;
n/=i;
}
if(first==0&&tmp) cout<<" "<<"*"<<" ";
if(tmp==1) cout<<i;
if(tmp>1) cout<<i<<"^"<<tmp;
if(tmp) first=0;
}
if(n!=1)
{
if(first==0) cout<<" "<<"*"<<" "<<n;
else cout<<n;
}
return 0;
}