easy
2024-02-06 16:32:43
发布于:湖南
19阅读
0回复
0点赞
#include <iostream>
#include <cstdio>
using namespace std;
int prime[] = {0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
int main(){
int n;
cin >> n;
for(int i = 1; i <= 25; i++){
if(n % prime[i]) continue;
cout << prime[i];
int ct = 0;
while(n % prime[i] == 0){
ct++;
n /= prime[i];
}
if(ct > 1) cout << '^' << ct;
if(n != 1){
cout << '*';
}
}
return 0;
}
这里空空如也
有帮助,赞一个