提交时间:2023-08-22 14:27:48
运行 ID: 99248
#include <iostream> #include <vector> using namespace std; vector<int> v; int main(){ int n; cin >> n; cout << n << "="; for (int i = 2;i*i<=n;i++){ if (n%i==0){ v.push_back(i); n/=i; while (n%i==0){ v.push_back(i); n/=i; } } } if (n!=1) v.push_back(n); for (int i = 0;i<v.size()-1;i++){ cout << v[i] << "*"; } cout << v[v.size()-1]; }