题意:任选素数组合为2019, 求总方案数。
计数dp傻逼题
场上死活跑不出来结果, 一进循环素数表就变零,从头调到尾
无fuck说,八字不合
答案:55965365465060
/*
Zeolim - An AC a day keeps the bug away
*/
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int INF = 0x3f3f3f3f;
const ld PI = acos(-1.0);
const ld E = exp(1.0);
const int MAXN = 1e6 + 10;
std::vector <int> prm;
ll dp[MAXN] = {1};
void prime()
{
bitset <MAXN> used;
used.set();
for(int i = 2; i <= 2019; ++i)
{
if(used[i])
{
prm.push_back(i);
for(int j = i; j <= 2019; j += i)
used[j] = false;
}
}
}
int main()
{
//ios::sync_with_stdio(false);
//cin.tie(0); cout.tie(0);
//freopen("D://test.in", "r", stdin);
//freopen("D://test.out", "w", stdout);
prime();
for(int i = 0; i < prm.size(); ++i)
{
for(int j = 2019; j >= prm[i]; --j)
{
dp[j] += dp[j - prm[i]];
}
}
cout << dp[2019] << '
';
return 0;
}