完全背包板子
#include<iostream> #include<cstdio> #define ri register int #define u long long namespace opt { inline u in() { u x(0),f(1); char s(getchar()); while(s<'0'||s>'9') { if(s=='-') f=-1; s=getchar(); } while(s>='0'&&s<='9') { x=(x<<1)+(x<<3)+s-'0'; s=getchar(); } return x*f; } } using opt::in; #define NN 4005 #define MM 4005 #define MO 2147483648 #include<algorithm> namespace mainstay { u N,M,a[NN],f[MM]={1}; inline void solve() { std::cin>>N; for(ri i(1);i<N;++i){ for(ri j(i);j<=N;++j){ f[j]=(f[j]+f[j-i])%MO; } } std::cout<<f[N]; } } int main() { //freopen("x.txt","r",stdin); std::ios::sync_with_stdio(false); mainstay::solve(); }