易知状态不会太多(\(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. 牛客小白月赛16 H 小阳的贝壳 (差分+线段树)

    链接:https://ac.nowcoder.com/acm/contest/949/H来源:牛客网 题目描述 小阳手中一共有 n 个贝壳,每个贝壳都有颜色,且初始第 i 个贝壳的颜色为 colico ...

  2. 《Data Structures and Algorithm Analysis in C》学习与刷题笔记

    <Data Structures and Algorithm Analysis in C>学习与刷题笔记 为什么要学习DSAAC? 某个月黑风高的夜晚,下班的我走在黯淡无光.冷清无人的冲之 ...

  3. poj3449(判断直线相交)

    题目链接:https://vjudge.net/problem/POJ-3449 题意:给出若干几何体,判断每个几何体与其它几何体的相交情况,并依次输出. 思路: 首先要知道的是根据正方形对角线的两个 ...

  4. [转帖]Windows安全认证是如何进行的?[Kerberos篇]

    Windows安全认证是如何进行的?[Kerberos篇] NTLM 的简单看了一下 基本上了解了.. 这个KERBEROS 的看不太懂 感觉说的我也有点迷糊.. 虽然是对称加密的 但是不清不楚的.. ...

  5. [转帖]Google Chrome 解决 “您的连接不是私密连接”

    Google Chrome 解决 “您的连接不是私密连接” 和被毒霸劫持 自己搭建了 k8s的 dashboard 结果 chrome 最新版本的打不开了.. 百度了下 园友的解决方案很完美 这里面转 ...

  6. 如何使用RedisTemplate访问Redis数据结构之Hash

    Redis的Hash数据机构 Redis的散列可以让用户将多个键值对存储到一个Redis键里面. public interface HashOperations<H,HK,HV> Hash ...

  7. JVM学习(一)Java虚拟机运行时数据区域

    一.Java内存区域 1.运行时数据区域 根据<Java 虚拟机规范(Java SE 7 版)>规定,Java 虚拟机所管理的内存包括以下几个运行时数据区域: 1.1 程序计数器 程序计数 ...

  8. 17.Letter Combinations of a Phone Number (char* 和 string 相互转化)

    leetcode 第17题 分析 char*和string相互转化 char*(或者char)转string 可以看看string的构造函数 default (1) string(); copy (2 ...

  9. k8s-helm安装

      kubernetes 1.15安装部署helm插件 简单介绍: Helm其实就是一个基于Kubernetes的程序包(资源包)管理器,它将一个应用的相关资源组织成为Charts,并通过Charts ...

  10. nginx 实践配置

    nginx.conf文件 user root; worker_processes 1; error_log logs/error.log crit; #error_log logs/error.log ...