记录详情
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){//不用signed会CE,不知道为啥。
int n,j=2;
cin>>n;
int a[10000001]={0};//再开大会MLE。
while(n!=1){
if(n%j==0){
n/=j;
a[j]++;
}else j++;
}
bool first=true;
for(int i=2;i<=j;i++){
if(a[i]>0){
if(!first) cout<<" * ";
if(a[i]>1) cout<<i<<"^"<<a[i];
else cout<<i;
first=false;
}
}
return 0;
}
回复@我,必关。