- BC20270020's blog
分解只因数
- 2024-11-5 16:00:56 @
#include<bits/stdc++.h>
using namespace std;
int main(){
int x,i=1;
cin>>x;
cout<<x<<"=";
while(i++<=x){
while(x%i==0){
x/=i;
cout<<i;
if(x!=1)
cout<<"*";
}
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main(){
int x,i=1;
cin>>x;
cout<<x<<"=";
while(i++<=x){
while(x%i==0){
x/=i;
cout<<i;
if(x!=1)
cout<<"*";
}
}
return 0;
}
By signing up a HFOJ universal account, you can submit code and join discussions in all online judging services provided by us.