题解
2026-01-31 20:52:19
发布于:广东
2阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
long long n,i=2;
bool first=true;
int main(){
cin>>n;
while(n>1){
if(n%i==0){
int cnt=0;
while(n%i==0){
n/=i;
cnt++;
}
if(!first)
cout<<" * ";
if(cnt>1)
cout<<i<<"^"<<cnt;
else
cout<<i;
first=false;
}
i++;
}
return 0;
}
这里空空如也


有帮助,赞一个