分解质因数
#include<bits/stdc++.h>
using namespace std;
int n;
map<int,int> M;
void f(int x){
for(int i=2;i<=sqrt(x);i++){
while(x%i==0){
M[i]++;
x/=i;
}
}
if(x!=1)M[x]++;
for(map<int,int>::iterator it=M.begin();it!=M.end();it++){
cout<<it->first<<","<<it->second<<endl;
}
}
int main(){
cin>>n;
f(n);
return 0;
}
标签:std,map,begin,end,int,质因数
From: https://www.cnblogs.com/hnzzlxs01/p/16656039.html