随笔分类 -  动态规划-思维dp

摘要:题意 求本质不同子序列的数量。 "传送门" 思路 思路一:$dp[i] = \sum_{j=last[a[i]]}^{i 1} dp[j]$ $dp[i]$ 表示第 i 位数字作为子序列的最后一位的数量。 当$a[i]$ 未出现过时: $dp[i]$ 可从之前所有状态包括空串转移过来,即:$dp[i 阅读全文
posted @ 2019-10-03 22:49 Acerkoo 阅读(795) 评论(0) 推荐(2)
摘要:题意 求只用 $\{0, 1, 2, 3, 4\}$ 五个数每个数最多使用 $a_i$ 次且没有前导零所能组成的 $n$ 位数的数量,答案模 $1e9+7$。 思路 貌似可以母函数+FFT ~~(但是这两个我都不会~~ 也可以用状压dp + 容斥原理来求解。 这个题求合法数不好求,所以可以计算总数减 阅读全文
posted @ 2019-09-28 23:12 Acerkoo 阅读(308) 评论(0) 推荐(0)
摘要:262144K In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named "Sena" are playing a video game. The game system of thi 阅读全文
posted @ 2018-09-12 23:19 Acerkoo 阅读(175) 评论(0) 推荐(0)
摘要:262144K After Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver a Nogaku show during the feast. To enjoy th 阅读全文
posted @ 2018-09-12 23:18 Acerkoo 阅读(241) 评论(0) 推荐(0)
摘要:A Question of Ingestion 题目描述 Stan Ford is a typical college graduate student, meaning that one of the most important things on his mind is where his n 阅读全文
posted @ 2018-09-03 20:01 Acerkoo 阅读(398) 评论(0) 推荐(0)
摘要:7033: Lounge Lizards 题目描述 Monitor lizards are a kind of reptile known mainly for their cold-bloodedness and addiction to computer screens. Due to thei 阅读全文
posted @ 2018-08-28 20:27 Acerkoo 阅读(218) 评论(0) 推荐(0)
摘要:4894: Booming Business 题目描述 You are an expert in bonsai, the Japanese art of cultivating small trees in small containers.Every year, you win the Bonsa 阅读全文
posted @ 2018-08-24 22:20 Acerkoo 阅读(221) 评论(0) 推荐(0)
摘要:问题 F: Making the Grade 题目描述 A straight dirt road connects two fields on FJ's farm, but it changes elevation more than FJ would like. His cows do not m 阅读全文
posted @ 2018-08-20 22:10 Acerkoo 阅读(769) 评论(0) 推荐(0)
摘要:问题 J: Simple Knapsack 题目描述 You have N items and a bag of strength W. The i-th item has a weight of wi and a value of vi.You will select some of the it 阅读全文
posted @ 2018-06-09 22:04 Acerkoo 阅读(159) 评论(0) 推荐(0)
摘要:6481: Integers on a Tree 题目描述 We have a tree with N vertices. The vertices are numbered 1,2,…,N. The i-th (1≤i≤N−1) edge connects the two vertices Ai 阅读全文
posted @ 2018-06-03 21:21 Acerkoo 阅读(162) 评论(0) 推荐(0)
摘要:D. Bookshelves time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output D. Bookshelves time limit 阅读全文
posted @ 2018-06-01 17:13 Acerkoo 阅读(116) 评论(0) 推荐(0)
摘要:D - Doing Homework D - Doing Homework D - Doing Homework Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do 阅读全文
posted @ 2018-05-18 21:11 Acerkoo 阅读(198) 评论(0) 推荐(0)