T
2025-08-19 14:46:53
发布于:浙江
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
long long n,t[1005],dp[1005];
void init(){
for(int i=2;i<=500;i++)
if(!t[i])
for(int j=2;i*j<=1000;j++)t[i*j]=1;
}
int main(){
cin>>n;
init();dp[0]=1;
for(int i=2;i<=n;i++)
if(!t[i])
for(int j=i;j<=n;j++)dp[j]+=dp[j-i];
cout<<dp[n];
return 0;
}
这里空空如也
有帮助,赞一个