提交时间:2023-08-22 14:29:16

运行 ID: 99250

#include <bits/stdc++.h> using namespace std; const int MOD = 10007; vector<int>h[MOD]; void insert(int x) { h[x%MOD].push_back(x); return; } bool find(int x) { int pos = x % MOD; for(int i = 0; i < h[pos].size();i++) { if(h[pos][i]==x)return true; } return false; } int n; bool fd = true; vector<int>prime; signed main() { cin >> n; cout << n << "="; int tmp1 = n,tmp2; for(int i = 2; i <= tmp1; i++) { if(!find(i)) { prime.push_back(i); if(n == 1)break; while(n%i==0) { n = n / i; if(!fd) { cout << "*" << i; } else { cout << i; fd = false; } } } tmp2 = prime.size(); for(int j = 0; j < tmp2; j++) { if(i*prime[j]>n)break; insert(i*prime[j]); if(i%prime[j]==0)break; } } return 0; }