mirror of
https://github.com/wczffl-503/OI-Codes.git
synced 2025-05-10 16:20:27 +08:00
36 lines
424 B
C++
36 lines
424 B
C++
#include <iostream>
|
|
#include <iomanip>
|
|
#include <cmath>
|
|
#include <cstdio>
|
|
using namespace std;
|
|
int main(){
|
|
int n,first=1,cnt=0;
|
|
cin >>n;
|
|
if(n==1){
|
|
cout <<"1=1";
|
|
return 0;
|
|
}
|
|
cout <<n<<"=";
|
|
for(int i=2;i<=n;i++){
|
|
while(n%i==0){
|
|
cnt++;
|
|
n/=i;
|
|
}
|
|
if(cnt>0){
|
|
if(first!=1){
|
|
cout <<"*";
|
|
}
|
|
else{
|
|
first=0;
|
|
}
|
|
cout <<i;
|
|
if(cnt>=2){
|
|
cout <<"^"<<cnt;
|
|
}
|
|
cnt=0;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|