当前位置: 首页 > news >正文

不用php做网站廊坊网站建设联系青橙网络

不用php做网站,廊坊网站建设联系青橙网络,什么软件做网站好些,推广的含义题目#xff1a;白书p274 题意: KTV里面有n首歌曲你可以选择,每首歌曲的时长都给出了. 对于每首歌曲,你最多只能唱1遍. 现在给你一个时间限制t (t10^9) , 问你在最多t-1秒的时间内可以唱多少首歌曲num , 且最长唱歌时间是多少time (time必须t-1) ? 最终输出num1 和…题目白书p274 题意:  KTV里面有n首歌曲你可以选择,每首歌曲的时长都给出了. 对于每首歌曲,你最多只能唱1遍. 现在给你一个时间限制t (t10^9) , 问你在最多t-1秒的时间内可以唱多少首歌曲num , 且最长唱歌时间是多少time (time必须t-1) ? 最终输出num1 和 time678 即可.  注意: 你需要优先让歌曲数目最大的情况下,再去选择总时长最长的.  解析:  每种歌曲只能用一次,所以是比较水的01背包题  最后枚举找到最大曲目数量并且时间尽量靠后即可 题目中t的范围是1e9但实际的t不会超过10000这就可以转化为01背包问题 (If you smiled when you see the title, this problem is for you ^_^) For those who don’t know KTV, see: http://en.wikipedia.org/wiki/Karaoke_box There is one very popular song called Jin Ge Jin Qu(). It is a mix of 37 songs, and is extremely long (11 minutes and 18 seconds) — I know that there are Jin Ge Jin Qu II and III, and some other unofficial versions. But in this problem please forget about them. Why is it popular? Suppose you have only 15 seconds left (until your time is up), then you should select another song as soon as possible, because the KTV will not crudely stop a song before it ends (people will get frustrated if it does so!). If you select a 2-minute song, you actually get 105 extra seconds! ....and if you select Jin Ge Jin Qu, you’ll get 663 extra seconds!!! Now that you still have some time, but you’d like to make a plan now. You should stick to the following rules: • Don’t sing a song more than once (including Jin Ge Jin Qu). • For each song of length t, either sing it for exactly t seconds, or don’t sing it at all. • When a song is finished, always immediately start a new song. Your goal is simple: sing as many songs as possible, and leave KTV as late as possible (since we have rule 3, this also maximizes the total lengths of all songs we sing) when there are ties. Input The first line contains the number of test cases T (T ≤ 100). Each test case begins with two positive integers n, t (1 ≤ n ≤ 50, 1 ≤ t ≤ 109 ), the number of candidate songs (BESIDES Jin Ge Jin Qu) and the time left (in seconds). The next line contains n positive integers, the lengths of each song, in seconds. Each length will be less than 3 minutes — I know that most songs are longer than 3 minutes. But don’t forget that we could manually “cut” the song after we feel satisfied, before the song ends. So here “length” actually means “length of the part that we want to sing”. It is guaranteed that the sum of lengths of all songs (including Jin Ge Jin Qu) will be strictly larger than t. Output For each test case, print the maximum number of songs (including Jin Ge Jin Qu), and the total lengths of songs that you’ll sing. Explanation: In the first example, the best we can do is to sing the third song (80 seconds), then Jin Ge Jin Qu for another 678 seconds. In the second example, we sing the first two (306999 seconds). Then we still have one second left, so we can sing Jin Ge Jin Qu for extra 678 seconds. However, if we sing the first and third song instead (3070100 seconds), the time is already up (since we only have 100 seconds in total), so we can’t sing Jin Ge Jin Qu anymore! Sample Input 2 3 100 60 70 80 3 100 30 69 70 Sample Output Case 1: 2 758 Case 2: 3 777 #includestdio.h #includestring.h #includemap #includealgorithm using namespace std; int t,m,n; int dp[110]; int w[10000010]; int main() {int k1;scanf(%d,t);while(t--){scanf(%d%d,m,n);for(int i0; im; i)scanf(%d,dp[i]);memset(w,-1,sizeof(w));w[0]0;/**care*/for(int i0; im; i)for(int jn-1; jdp[i]; j--)w[j]max(w[j],w[j-dp[i]]1);int ans0,sum;for(int i0;in;i){if(answ[i]){answ[i];sumi;}}printf(Case %d: %d %d\n,k,ans1,sum678);}return 0; }
http://www.zqtcl.cn/news/221331/

相关文章:

  • 陕西专业网站建设哪家好甜点网站里的新闻资讯怎么做
  • 邯郸企业网站团队h5微场景制作软件
  • 镇江建工建设集团网站泛微e8做网站门户
  • 适合友情链接的网站全球软件公司排行榜
  • 沈阳网站制作 600元网站飘动广告代码
  • 最先进的无锡网站建设wordpress调用 别的网站
  • 河南网站备案地址静安青岛网站建设
  • 烟台网站建设推荐企汇互联见效付款查看网站被百度收录
  • 做标签网站360街景地图怎么看
  • 深圳网站建设领先天津建设企业网站
  • 网站建设犭金手指C排名15温州 建网站的公司
  • 邢台建设银行官方网站公众号开发者密码是什么意思
  • 网站录入信息 前台查询功能怎么做营销网站主题有哪些内容
  • 网站SEO的评价触屏音乐网站源码
  • 网站开发u盘128够吗网站建设是固定资产嘛
  • 网站域名备案信息wordpress搜索文章内容
  • 出口退税在哪个网站做怎么在一起做网站上拿货
  • 网站友链查询传到网站根目录
  • 网站服务器端口设置北京专业网络直播制作
  • 可以免费做演播的听书网站南京企业自助建站
  • 软件下载类型网站怎么做长沙官网优化技术
  • 药品网站订单源码外贸网站建设服务器
  • 深圳网站制作07551免费开发网站
  • 如何直接用jsp做网站不写servletwordpress模板 单栏
  • 长沙网站建设哪个公司好设计公司网站 唐山
  • 原创小说手机网站制作需要多少钱郴州seo外包
  • 深圳市大鹏建设局网站网站关键词没排名怎么办
  • 水果商城网站制作多少钱c#如何做公司网站
  • 国内做进口的电商网站网站建设的经验做法
  • 蚂蚁搬家公司官方网站免费网站软件制作