提交时间:2023-08-22 16:27:45
运行 ID: 99391
#include <iostream> #include <cmath> using namespace std; bool prime(int x){ for(int i=2;i<=sqrt(x);i++){ if(x % i == 0) return false; } return x > 1; } void lenzys(int x){ if(x == 1) return; int m = 2; while(!prime(x)){ while(x % m != 0){ m++; } cout << m << '*'; x /= m; } cout << x; return; } int main(){ int a; cin >> a; cout << a << '='; lenzys(a); return 0; }