diff --git a/POJ/1185.cpp b/POJ/1185.cpp new file mode 100644 index 0000000..151d171 --- /dev/null +++ b/POJ/1185.cpp @@ -0,0 +1,154 @@ +#include +#include +#include +#include +using namespace std; + +#define _BITMOVE(x) (1<0) + { + if(x&1) ++c; + x=x>>1; + } + return c; +} + +int solve(int n,int m) +{ + memset(dp,-1,sizeof(int)*MAXLINE*ESTIMATED_MAXSTATUS*ESTIMATED_MAXSTATUS); + memset(map,0,sizeof(STATE)*MAXLINE); + + for(int i=0;i0) printf("0\n"); + else printf("1\n"); + return 0; + } + int statusCount=-1; + for(STATE ci=0;ci<(STATE)_BITMAX(m);ci++) + { + if(isGoodState(ci)) + { + availableStatus[++statusCount]=ci; + countOfOne[statusCount]=getCountOfOneByState(ci); + } + } + ++statusCount; + /// Initialize the Line 0 with all available status. + for(int ci=0;ci