From 361d65789693dfb2affad347eabd04f07850b05e Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Tue, 16 Aug 2016 15:49:26 +0800 Subject: [PATCH] Create 1176.cpp --- POJ/1176.cpp | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 POJ/1176.cpp diff --git a/POJ/1176.cpp b/POJ/1176.cpp new file mode 100644 index 0000000..a1967a5 --- /dev/null +++ b/POJ/1176.cpp @@ -0,0 +1,122 @@ +#include +#include +#include +#include +#include +#include +#include +using namespace std; +int N; +int C; +int a[101]; +int _open[101]; +int _close[101]; +string ss[300]; +void do1() +{ + for(int i=1;i<=100;++i) + a[i]^=1; +} +void do2() +{ + for(int i=2;i<=N;i+=2) + a[i]^=1; +} +void do3() +{ + for(int i=1;i<=N;i+=2) + a[i]^=1; +} +void do4() +{ + for(int i=1;i<=N;i+=3) + a[i]^=1; +} +int cnt=0; +int check() +{ + for(int i=1;i<=N;++i){ + if(_open[i]==1&&a[i]==0)return 1; + if(_close[i]==1&&a[i]==1)return 1; + } + return 0; +} +void dfs(int c) +{ + if(c==C) + { + if(check()==0) + { + ss[cnt]=""; + for(int i=0; i4) + { + C%=2; + if (C==1) + { + C=3; + } + else + { + C=4; + } + } + dfs(0); + sort(ss,ss+cnt); + cout<