随笔分类 -  动态规划

Codeforces Hello 2018 E题Logical Expression dp+最短路 好题
摘要:j题目链接: http://codeforces.com/contest/913/problem/E 题意: 给你x,y,z三个变量,与& 或| 非! 括号() 四种运算符,规定括号和非优先级最高,其次与&,最后或|。 对于输入的真值表,输出最小字典序的逻辑表达式 挺难想的。关键点在于怎么定义状态并 阅读全文

posted @ 2018-01-25 20:39 缄默火 阅读(220) 评论(0) 推荐(0)

Codeforces 55D Beautiful numbers 数位dp
摘要:题目地址:http://codeforces.com/problemset/problem/55/D 若一个数字n能被它数位上的每一个非零数字整除,称这个数为Beautiful number。 问给定区间[l, r]内有多少个Beautiful numbers。 1≤l≤r≤9*1e18 很明显的数 阅读全文

posted @ 2018-01-24 19:54 缄默火 阅读(182) 评论(0) 推荐(0)

hdu-3689 Infinite monkey theorem 概率dp+kmp
摘要:有一只猴子随机敲键盘,给出它可能敲的键以及敲各个键的概率。 输入:n,表示有多少个键,m,表示猴子会敲m次键 n个二元组(字母,数字) 表示键代表的字母及其被敲的概率。 最后一个目标字符串。 问这只猴子敲了m次键后得到的字符串包含目标字符串的概率。 最主要的还是怎么定义出具有无后效性的状态。 用dp 阅读全文

posted @ 2018-01-24 18:47 缄默火 阅读(246) 评论(0) 推荐(0)

hdu 4468 spy 极其精彩的一道kmp灵活运用题
摘要:出的超级好的一道题。至于好在哪里,请思考题目: 题意抽象出来为给定一个字符串r,找出它的一个最短后缀s,使得这个r可以被 s的某前缀+s的某前缀+......+s的某前缀+s本身构造出来。 具体题目描述如下: “Be subtle! Be subtle! And use your spies for 阅读全文

posted @ 2017-10-05 22:30 缄默火 阅读(325) 评论(0) 推荐(0)

Subsequence Count 2017ccpc网络赛 1006 dp+线段树维护矩阵
摘要:Problem Description Given a binary string S[1,...,N] (i.e. a sequence of 0's and 1's), and Q queries on the string.There are two types of queries:1. F 阅读全文

posted @ 2017-08-30 18:36 缄默火 阅读(332) 评论(0) 推荐(0)

The Karting 2017ccpc网络赛 1008
摘要:The Karting championship will be held on a straight road. There are N keypoints on the road. The path between keypoint i and i+1 has a degree of diffi 阅读全文

posted @ 2017-08-30 17:47 缄默火 阅读(277) 评论(0) 推荐(0)

Kickstart Round D 2017 problem A sightseeing 一道DP
摘要:这是现场完整做出来的唯一一道题Orz。。而且还调了很久的bug。还是太弱了。 Problem When you travel, you like to spend time sightseeing in as many cities as possible, but sometimes you mi 阅读全文

posted @ 2017-07-28 16:34 缄默火 阅读(213) 评论(0) 推荐(0)

斜率DP hdu 3507
摘要:Problem Description Zero has an old printer that doesn't work well sometimes. As it is antique, he still like to use it to print articles. But it is t 阅读全文

posted @ 2017-06-18 20:18 缄默火 阅读(303) 评论(0) 推荐(0)

一道DP
摘要:也是校赛学长出的一道题~想穿了很简单。。但我还是听了学长讲才明白。 观察力有待提高。 Problem D: YaoBIG’s extra homeworkTime LimitMemory Limit1 s128 MBDescriptionOne day, a teacher assigned thi 阅读全文

posted @ 2017-04-22 17:25 缄默火 阅读(265) 评论(0) 推荐(0)

导航