diff --git a/S2OJ/886/886.cpp b/S2OJ/886/886.cpp new file mode 100644 index 00000000..5194e32d --- /dev/null +++ b/S2OJ/886/886.cpp @@ -0,0 +1,48 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +int n, k; +int cnt, r[2005], s[2005]; +long long f[15][2005][105], ans; + +void dfs(int x, int sum, int len) { + if (len >= n) { + r[++cnt] = x; + s[cnt] = sum; + return; + } + + dfs(x, sum, len + 1); + dfs(x + (1 << len), sum + 1, len + 2); +} + +int main() { + std::ios::sync_with_stdio(false); + + cin >> n >> k; + + dfs(0, 0, 0); + + for (int i = 1; i <= cnt; i++) f[1][i][s[i]] = 1; + + for (int i = 2; i <= n; i++) { + for (int j = 1; j <= cnt; j++) { + for (int p = 1; p <= cnt; p++) { + if ((r[j] & r[p]) || ((r[j] << 1) & r[p]) || (r[j] & (r[p] << 1))) continue; + + for (int l = k; l >= s[j]; l--) { + f[i][j][l] += f[i - 1][p][l - s[j]]; + } + } + } + } + + for (int i = 1; i <= cnt; i++) ans += f[n][i][k]; + + cout << ans << endl; + + return 0; +} diff --git a/S2OJ/886/data/data1.in b/S2OJ/886/data/data1.in new file mode 100644 index 00000000..b4555149 --- /dev/null +++ b/S2OJ/886/data/data1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb1135f17e81facd6ba91c9c27548eb003954f57acdfd8fac0a71ee5a1610ab1 +size 5 diff --git a/S2OJ/886/data/data1.out b/S2OJ/886/data/data1.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/S2OJ/886/data/data1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/S2OJ/886/data/data10.in b/S2OJ/886/data/data10.in new file mode 100644 index 00000000..42dfc95b --- /dev/null +++ b/S2OJ/886/data/data10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f6af77f0d0e9aa819a11c68c9cc6672de6fa0b5a4b4dc3ef98b2a495ec62cbf +size 5 diff --git a/S2OJ/886/data/data10.out b/S2OJ/886/data/data10.out new file mode 100644 index 00000000..9360a030 --- /dev/null +++ b/S2OJ/886/data/data10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce59c4eb7a5d90ff4c3b63345ccdc8177ad79e9509f31bb74b2a01b920aeabdf +size 12 diff --git a/S2OJ/886/data/data2.in b/S2OJ/886/data/data2.in new file mode 100644 index 00000000..b94b46a9 --- /dev/null +++ b/S2OJ/886/data/data2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa78e40a34b37d79e1d1ea2f2ddc5a7e13206a0d30d0c226a0d417b28e44a1ce +size 5 diff --git a/S2OJ/886/data/data2.out b/S2OJ/886/data/data2.out new file mode 100644 index 00000000..260a14d7 --- /dev/null +++ b/S2OJ/886/data/data2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf1df3dc88594a0389d4ca24d75a74ee54aabc9d58329d284e024373b41cce88 +size 8 diff --git a/S2OJ/886/data/data3.in b/S2OJ/886/data/data3.in new file mode 100644 index 00000000..57d84b1a --- /dev/null +++ b/S2OJ/886/data/data3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7463e54df91da56371e246c0ce49f246c987e5ca07afd4d51edcbc9c8f43ca4d +size 5 diff --git a/S2OJ/886/data/data3.out b/S2OJ/886/data/data3.out new file mode 100644 index 00000000..0f63ee94 --- /dev/null +++ b/S2OJ/886/data/data3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ddef4f103668e7d5c8dda7bfd01a4cd4feb954e9b060c5c3529a8e3e9bd2ac8 +size 8 diff --git a/S2OJ/886/data/data4.in b/S2OJ/886/data/data4.in new file mode 100644 index 00000000..2407aea3 --- /dev/null +++ b/S2OJ/886/data/data4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d774aa7655071c0c8e65f52bf6a4dbdf7629769ec767fb916ae9f8508211ad8d +size 4 diff --git a/S2OJ/886/data/data4.out b/S2OJ/886/data/data4.out new file mode 100644 index 00000000..9f4ac450 --- /dev/null +++ b/S2OJ/886/data/data4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d8be10b3ed50cc658d676e141da61984e7ae711675bdf3a4c8278348d0a6c6b +size 6 diff --git a/S2OJ/886/data/data5.in b/S2OJ/886/data/data5.in new file mode 100644 index 00000000..8198d554 --- /dev/null +++ b/S2OJ/886/data/data5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a4788aa38c41a27eb7736ddb2e46b912822ffcdec44aeb91ecedc28c662b4c4 +size 5 diff --git a/S2OJ/886/data/data5.out b/S2OJ/886/data/data5.out new file mode 100644 index 00000000..c23a5bac --- /dev/null +++ b/S2OJ/886/data/data5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8696b08a4992019a836bf24f68ad7789d196193496ec9f3094f3ee0bdc1b8f13 +size 10 diff --git a/S2OJ/886/data/data6.in b/S2OJ/886/data/data6.in new file mode 100644 index 00000000..03164fc0 --- /dev/null +++ b/S2OJ/886/data/data6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:813405789e1574e33f019c0188c424a295a898f35a1185031640367627bcc0ea +size 5 diff --git a/S2OJ/886/data/data6.out b/S2OJ/886/data/data6.out new file mode 100644 index 00000000..f9424ac0 --- /dev/null +++ b/S2OJ/886/data/data6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96de8d2a0c86930412f63f77f01d7d570a77e293e71548321fd4a4bd46cd70d6 +size 12 diff --git a/S2OJ/886/data/data7.in b/S2OJ/886/data/data7.in new file mode 100644 index 00000000..d28bc50a --- /dev/null +++ b/S2OJ/886/data/data7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ece3d232c1ca9ef8a80b6fdb1585b8f5cf653b9dd023b0521c8da64db859ffac +size 4 diff --git a/S2OJ/886/data/data7.out b/S2OJ/886/data/data7.out new file mode 100644 index 00000000..bf7021d6 --- /dev/null +++ b/S2OJ/886/data/data7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6c21e8d260fe71882debdb339d2402a2ca7648529bc2303f48649bce0380017 +size 3 diff --git a/S2OJ/886/data/data8.in b/S2OJ/886/data/data8.in new file mode 100644 index 00000000..7d88d78b --- /dev/null +++ b/S2OJ/886/data/data8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:501ddf83f5c6affb4bdc50a6a3f4feab9f41898825e236599893739a52e1196c +size 4 diff --git a/S2OJ/886/data/data8.out b/S2OJ/886/data/data8.out new file mode 100644 index 00000000..3c3743df --- /dev/null +++ b/S2OJ/886/data/data8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29c0f6e8d498ee4552963cb2e4c743a2f0c81bd93c9e8dd0f25486a3289443b6 +size 5 diff --git a/S2OJ/886/data/data9.in b/S2OJ/886/data/data9.in new file mode 100644 index 00000000..71f4c5ac --- /dev/null +++ b/S2OJ/886/data/data9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb54f1b8b2b5e5ab093f576b682ed59cc1ee3dc397f31f5209616ae155cc3471 +size 4 diff --git a/S2OJ/886/data/data9.out b/S2OJ/886/data/data9.out new file mode 100644 index 00000000..99630a52 --- /dev/null +++ b/S2OJ/886/data/data9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6bd25bb864300af73419a3cc22cd69ba1fcd54f526f1a803144382bd4da5e3c +size 8 diff --git a/S2OJ/886/data/problem.conf b/S2OJ/886/data/problem.conf new file mode 100644 index 00000000..455bc67f --- /dev/null +++ b/S2OJ/886/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d17ddcd48df5501a302f25bc12953eef0236dc133e68cd15734a49311478391f +size 193