HDU 1260 Tickets(基础dp)】的更多相关文章

题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1260 题意 有N个人来买电影票 因为售票机的限制 可以同时 卖一张票 也可以同时卖两张 卖两张的话 两个人必须是相邻的 给出 N 个 价格 是 一个一个买的时间花费 给出 N - 1个价格 是 相邻的两个人一起买的时间花费 求出 最小的时间花费 思路 dp[i] 表示 卖到当前这个人的时间花费 状态转移方程 dp[i] = min(dp[i - 2] + b[i - 1], dp[i - 1] +…
2046 : 生化危机 时间限制:1 Sec内存限制:128 MiB提交:19答案正确:8 题目描述 当致命的T病毒从Umbrella Corporation 逃出的时候,地球上大部分的人都死去了. 麻烦的是,他们并没有真正的死去. 爱丽诗在一个狭窄的巷子中,遇见了n个丧尸(编号1-n),巷子太窄了,爱丽诗只能按顺序解决它们. 爱丽诗擅长用匕首和弓箭,当爱丽诗面临编号为i的丧尸时,匕首每次只能解决一个丧尸用时为a[i],弓箭每次能且只能解决两个相邻的丧尸(丧尸i,和丧尸i+1),用时为b[i].…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1260 Tickets Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7318    Accepted Submission(s): 3719 Problem Description Jesus, what a great movie! Th…
Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description There is a number sequence A1,A2....An,you can select a interval [l,r] or not,all the numbers Ai(l≤i≤r) will become f(Ai).f(x)=(1890x+143)mod1…
一开始我对这个题的题意理解有问题,居然超时了,我以为是区间dp,没想到是个水dp,我泪奔了.... #include<stdio.h> #include<string.h> #include<algorithm> #include<cmath> #include<iostream> using namespace std; ///本来以为是一个区间dp,结果是个水dp,从前往后选就可以了,选的方式有两种,每次都是最优,结果也最优; ///我还TL…
Tickets Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 711    Accepted Submission(s): 354 Problem Description Jesus, what a great movie! Thousands of people are rushing to the cinema. However,…
http://acm.hdu.edu.cn/showproblem.php?pid=1260 用dp[i]表示处理到第i个的时候用时最短. 那么每一个新的i,有两个选择,第一个就是自己不和前面的组队,第二就是和前面的组队. 那么dp[i] = min(dp[i - 1] + a[i], dp[i - 2] + b[i]);  前者是自己组队. 边界条件 dp[0] = 0; dp[1] = a[1]; #include <cstdio> #include <cstdlib> #in…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1260 Problem Description Jesus, what a great movie! Thousands of people are rushing to the cinema. However, this is really a tuff time for Joe who sells the film tickets. He is wandering when could he go…
http://acm.hdu.edu.cn/showproblem.php?pid=1260 题目大意:n个人买票,每个人买票都花费时间,相邻的两个人可以一起买票以节约时间: 所以一个人可以自己买票也可以和前面的人一起买也可以和后面的人一起买,和后面的人一起买也就相当于后面的人后前面的人一起买: 因此一个人有两种买票方式自己买或者和前面的人一起买,选取耗时最短的: 得到DP的状态方程: —dp[i] = min(dp[i - 1] + a[i], dp[i - 2] + b[i]); 样例: 1…
Tickets Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1935    Accepted Submission(s): 933 Problem Description Jesus, what a great movie! Thousands of people are rushing to the cinema. However,…