From 523ea7f4da391ee81574d1d618039395c843a25d Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 3 Aug 2016 15:50:31 +0800 Subject: [PATCH] Create 1185.cpp --- POJ/1185.cpp | 154 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 POJ/1185.cpp 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