URAL 2018 The Debut Album (DP)】的更多相关文章

题意:给出n长度的数列,其实1的连续个数不超过a,2的连续个数不超过b. 析:dp[i][j][k] 表示前 i 个数,以 j 结尾,并且连续了k个长度,要用滚动数组,要不然MLE. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath…
2018. The Debut Album Time limit: 2.0 secondMemory limit: 64 MB Pop-group “Pink elephant” entered on recording their debut album. In fact they have only two songs: “My love” and “I miss you”, but each of them has a large number of remixes. The produc…
http://acm.timus.ru/problem.aspx?space=1&num=2018 真心爱过,怎么能彻底忘掉 题目大意: 长度为n的串,由1和2组成,连续的1不能超过a个,连续的2不能超过b个 dpa[i] 表示长度为i时以a为结尾的串的个数,dpb[i] 类似 求dpa[i]时 需要枚举结尾a的个数就可以了 dpb[i] 类似 #include <iostream> #include <stdio.h> #include <stdlib.h>…
题目地址:Ural 2018 简单DP.用滚动数组. 代码例如以下: #include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <queue> #include <map> #i…
The Debut Album 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/G Description Pop-group "Pink elephant" entered on recording their debut album. In fact they have only two songs: "My love" and "I miss you", but each…
题目链接 隔了一年零三个月,重新刷URAL,这题挺麻烦的输出路径.输出路径挺扯的,乱写了写乱改改就A了...我本来想用很靠谱,记录每一条路径的,然后输出最小的,结果Tle,然后我使劲水水又过了一组,发现别人的题解..直接来了一次 就过了..我乱搞了搞,倒着记录最小的,然后倒着输出,就过了... #include <cstring> #include <cstdio> #include <string> #include <iostream> #include…
C - Anniversary FireworkTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87643#problem/B Description Denis has to prepare the Ural State University 90th anniversary firework. He bought n rockets and s…
题目地址:Ural 1073 DP水题.也能够说是背包. #include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <queue> #include <map> #include…
1814: Ural 1519 Formula 1 Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 942  Solved: 356[Submit][Status][Discuss] Description Regardless of the fact, that Vologda could not get rights to hold the Winter Olympic games of 20**, it is well-known, that t…
[BZOJ1814]Ural 1519 Formula 1 题意:一个 m * n 的棋盘,有的格子存在障碍,求经过所有非障碍格子的哈密顿回路个数.(n,m<=12) 题解:插头DP板子题,刷板子,附带题解链接. 如何存放状态呢?可以采用hash,我们的hash表形如一个队列,每次新加入一个状态时,就沿着这个状态在队列中对应的hash值不断向后找,直到找到这个状态或者发现一个空位为止. 本题我的状态采用了4进制表示. #include <cstdio> #include <cstr…