Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
151157 陈家宝 质数和分解 C++ 通过 100 0 MS 256 KB 419 2024-06-12 13:32:11

Tests(10/10):


#include<bits/stdc++.h> using namespace std; int a[205],f[205],cnt,n; bool sushu(int x){ for (int i = 2;i * i <= x;i++)if (x % i == 0)return false; return true; } int main(){ for (int i = 2;i <= 200;i++) if (sushu(i)){ cnt++; a[cnt] = i; } f[0] = 1; f[1] = 0; for (int i = 1;i <= cnt;i++)for (int j = a[i];j <= 200;j++)f[j] += f[j - a[i]]; while (cin>>n)cout<<f[n]<<endl; return 0; }


测评信息: