能给一组hack吗?
#include <bits/stdc++.h>
using namespace std;
#define sp putchar(' ')
#define en putchar('\n')
#define pb push_back
#define int long long
#define P 998244353
#define HP 1000000000000002097
#define N (int)(1e6+5)
int read(){ char ch=getchar();int x=0,f=1;while(ch>'9' || ch<'0'){if(ch=='-') f=-1;ch=getchar();}while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();return x*f; }
void print(int x){ if(x<0) putchar('-'),x=-x;if(x>9)print(x/10);putchar(x%10+'0'); }
int n;
bool vis[N];
int dp[N];
vector<int> p[N];
void prime()
{
vis[1]=1;
for(int i=2;i<=1000000;i++){
if(!vis[i]){
for(int j=i;j<=1000000;j+=i) vis[j]=1,p[j].pb(i);
}
}
for(int i=2;i<=1000000;i++){
dp[i]=dp[i-1]+1;
for(auto x:p[i]) dp[i]=min(dp[i],dp[i/x]+1);
}
}
signed main()
{
ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
prime();
while(cin>>n){
cout<<dp[n]<<"\n";
}
return 0;
}