Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
147061 | 周子博 | 质数和分解 | C++ | 通过 | 100 | 3 MS | 4732 KB | 455 | 2024-05-16 13:34:48 |
#include<iostream> #include<cmath> #include<cstdio> #include <bits/stdc++.h> using namespace std; int a,b[200],c,d[1145141],e,f,g,h,i,j,k; bool o[10004]; int main() { memset(o,true,sizeof(o)); c=0; for(e=2;e<=200;e++) if(o[e]==1) { b[++c]=e; for(f=e*e;f<=200;f+=e) o[f]=0; } cin>>a; memset(d,0,sizeof(d)); d[0]=1; for(e=1;e<=c;e++) for(f=b[e];f<=a;f++) d[f]+=d[f-b[e]]; cout<<d[a]<<endl; return 0; }