提交时间:2023-08-22 09:58:03
运行 ID: 99139
#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 << '='; lenxys(); return 0; }