Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #define NMAX 2005
- #define MOD 3000017
- using namespace std;
- int N,i,j;
- unsigned long long P[NMAX+5],cnt,PC[NMAX+5],Sol;
- int mod(unsigned long a,int m)
- {
- a%=m;
- if(a<0)
- a+=m;
- return a;
- }
- unsigned long long partitions_increasing(int n)
- {
- PC[0]=1;
- for(i=1;i<=n;++i)
- for(j=n;j>=i;--j)
- PC[j]=mod(PC[j]+PC[j-i],MOD);
- return PC[n];
- }
- unsigned long long compute_partitions1(int n)
- {
- P[0]=1;
- for(int i=1;i<=n;++i)
- for(int j=i;j<=n;++j)
- P[j]=mod(P[j]+P[j-i],MOD);
- return P[n];
- }
- int main()
- {
- ifstream f("pdl.in");
- f>>N;
- f.close();
- compute_partitions1(N);
- partitions_increasing(N);
- Sol=(P[N]-PC[N]+MOD)%MOD;
- ofstream g("pdl.out");
- g<<Sol;
- g.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment