易知状态不会太多(\(3329\)个),直接搜一下,按照能不能连在后面建边,跑一遍dp即可

#include <bits/stdc++.h>

using namespace std;

struct S {
int cnt;
vector<int> s;
}a[5000]; int n, m = 10, L = 32;
vector<int> G[5000];
long long f[5000][15];
int tmp[100]; void dfs(int len, int cnt) {
if(len >= L) {
if(len > L) return ;
a[++n].cnt = cnt;
a[n].s.resize(cnt);
for(int i = 0; i < cnt; ++i) a[n].s[i] = tmp[i+1];
return ;
}
tmp[cnt+1] = 2;
dfs(len+2, cnt+1);
tmp[cnt+1] = 3;
dfs(len+3, cnt+1);
} bool check(S &x, S &y) {
static int b[50];
memset(b, 0, sizeof b);
int sum = 0;
for(int i = 0; i < x.cnt; ++i) b[sum+x.s[i]]++, sum += x.s[i];
sum = 0;
for(int i = 0; i < y.cnt; ++i) b[sum+y.s[i]]++, sum += y.s[i];
for(int i = 2; i < L; ++i) if(b[i] > 1) return false;
return true;
} int main() {
dfs(0, 0);
for(int i = 1; i <= n; ++i) {
f[i][1] = 1;
for(int j = 1; j < i; ++j) if(check(a[i], a[j])) G[i].push_back(j), G[j].push_back(i);
}
for(int i = 2; i <= m; ++i)
for(int u = 1; u <= n; ++u)
for(int j = 0; j < G[u].size(); ++j)
f[u][i] += f[G[u][j]][i-1];
long long ans = 0;
for(int i = 1; i <= n; ++i) ans += f[i][m];
printf("%lld\n", ans);
return 0;
}

ProjectEuler215 Crack-free Walls的更多相关文章

  1. reversing-Easy Crack

    Easy Crack 程序启动后输入任意字符会显示一个MessageBox的Incorrect Password. 打开OllyDbg,载入程序后查找到目标字符串Incorrect Password, ...

  2. crack.vbs病毒,优盘里所有文件全变成快捷方式

    去了一趟学校打印店,用优盘copy打印了点东西,当时在打印店电脑里打开优盘的时候里面就变成了快捷方式,但没怎么在意.回来之后在自己电脑上居然也这样了.网上一搜是中了crack.vbs病毒了.格式化优盘 ...

  3. MATLAB的crack安装小曲

    MATLAB的crack安装小曲 本学期要学数学模型和数值分析,需要用MATLAB,便琢磨着装MATLAB.我同专业的同学会装MATLAB的crack,他是数学协会的理事长,平时爱吹牛,问他一个简单的 ...

  4. Walls(floyd POJ1161)

    Walls Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7677   Accepted: 3719 Description ...

  5. sdut 2165:Crack Mathmen(第二届山东省省赛原题,数论)

    Crack Mathmen Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述  Since mathmen take securit ...

  6. MITM to crack Https connections

    Everybody knows that https is http over SSL, and https is a secure way for protecting confidential d ...

  7. CentOS下modelsim 10.2c install & crack

    install: 1. install is easy to all : run install.linux 2 crack: this section is important: a. instal ...

  8. Sdut 2165 Crack Mathmen(数论)(山东省ACM第二届省赛E 题)

    Crack Mathmen TimeLimit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Since mathmen take security ...

  9. 最短路(数据处理):HDU 5817 Ice Walls

    Have you ever played DOTA? If so, you may know the hero, Invoker. As one of the few intelligence car ...

随机推荐

  1. js模板(template.js)实现页面动态渲染

    template.js是由纯JavaScript编写的第三方模板引擎.点击https://github.com/yanhaijing/template.js可进行下载. 在页头导入模板文件 <s ...

  2. centOS服务器-firewall防火墙开放端口

    前言 日常开发中,我们常常会因为服务器各种端口未开放出现各种问题,下面我们就来简单了解下服务器上的端口开放!!! 作为一个后台开发,日常接触最多的除了代码就是服务器了: 产品:谁谁, 线上有个功能报错 ...

  3. Chrome浏览器控制台报 POST http://*** net::ERR_BLOCKED_BY_CLIENT

    开发项目广告模块时,遇到前端提交的请求后台拿不到,好像被什么拦截了,查看了过滤器,拦截器都无错误,且请求也到不了拦截器,chrome浏览器报:ERR_BLOCKED_BY_CLIENT错误 搞腾一半天 ...

  4. tomcat单机多应用部署配合Nginx负载均衡

    一.Windows 配置tomcat . 安装两个tomcat服务器以上 . 配置环境变量 CATALINA_BASE:D:\servers\Tomcat8 CATALINA_HOME:D:\serv ...

  5. PAT题目AC汇总(待补全)

    题目AC汇总 甲级AC PAT A1001 A+B Format (20 分) PAT A1002 A+B for Polynomials(25) PAT A1005 Spell It Right ( ...

  6. numpy数组常用计算

    在说numpy库数组的计算之前先来看一下numpy数组形状的知识: 创建一个数组之后,可以用shape来查看其形状,返回一个元组 例如:a = np.array([[1, 2, 3], [4, 5, ...

  7. 3.解决git不可用问题

    升级gityum -y update git   配置阿里云yum源yum -y update nssyum -y update nss curl libcurl

  8. Codeforces 1247D. Power Products

    传送门 要满足存在 $x$ ,使得 $a_i \cdot a_j = x^k$ 那么充分必要条件就是 $a_i \cdot a_j$ 质因数分解后每个质因数的次幂都要为 $k$ 的倍数 证明显然 设 ...

  9. Go入门所踩过的坑:cannot find package "" in any of

    问题:cannot find package "" in any of.现已按照博客解决,分享一种自己踩得坑欢迎大神指导交流! 首先使用go env查看当前环境变量,新手入门出现找 ...

  10. MVC和WebApi中设置Area中的页为首页

    拿WebApi为例,我们一般会生成一份帮助文档,帮助文档会在Area中 我们现在要讲帮助文档设为首页 只需在App_Start文件夹下添加 RouteConfig 类 public class Rou ...