A more retarded DP.
1#include <cstdio>2#include <iostream>3#include <cstring>4#include <cstdlib>5#include <cmath>6#include <queue>7#include <algorithm>8#include <vector>9 #defineM 1009Ten #defineEPS 1e-10 One #defineMO 10000 A #definell Long Long - using namespacestd; - ll Read () the { - CharCh=GetChar (); -ll x=0, f=1; - for(;ch<'0'|| Ch>'9'; ch=GetChar ()) + if(ch=='-') -f=-1; + for(; ch>='0'&&ch<='9'; ch=GetChar ()) Ax=x*Ten+ch-'0'; at returnx*F; - } - intN,k,f[m][m],sum[m][m]; - intMain () - { -n=read (); ink=read (); - for(intI=0; i<=n;i++) tof[i][0]=sum[i][0]=1; + for(intI=1; i<=n;i++) - for(intj=1; J<=min (k, (i1) *i/2); J + +) the { * if(j-i>=0) $F[i][j]= (sum[i-1][min (J, (I2) * (I-1)/2)]-sum[i-1][max (0, j-i)]+mo)%MO;Panax Notoginseng Else -f[i][j]=sum[i-1][min (J, (I2) * (I-1)/2)]%MO; theSum[i][j]= (sum[i][j-1]+F[I][J])%MO; + } Aprintf"%d\n", F[n][k]); the return 0; + } -
Bzoj 2431: [HAOI2009] Reverse sequence