当前位置: 首页 > 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.pierceye.com/news/221331/

相关文章:

  • 制作个人网站要多少钱重庆工程信息官网
  • 那里建设网站好珠海网站建设公司哪个好
  • 从化市营销型网站建设工业和信息化部五系网站建设
  • 网站建设的开发方法有哪些wordpress 企业站主题
  • 长治网站建设案例找人做一个小网站需要多少钱
  • html5 网站布局应用教程韩雪冬 网站
  • 行业网站维护印刷公司网站模板
  • 做自媒体需要用的网站wordpress更换语言包
  • 电子书推送网站怎么做重庆产品网站推广
  • 免费做课设的网站织梦本地安装网站
  • 龙岗做网站公司szaow品牌网站建设公司哪好
  • 设计网站项目描述怎么样下载网页上的视频
  • 比较开放的浏览器清远网站seo
  • 个人网站的域名注册怎么做手机app软件开发
  • 卡盟网站开发google play三件套
  • 缠绕机东莞网站建设技术支持在线协同办公软件
  • 邵阳做网站哪个公司好接推广网站
  • 媒体网站模版网站添加提醒
  • 平度网站建设公司电话制作动画网站模板
  • 教育手机网站开发郑州网站修改建设
  • 查询网站入口长春网站排名推广
  • 中国建设工程造价网站丰润网站建设
  • 电子项目外包网站可以发描文本的网站
  • 论文中引用网站中wordpress外汇行情
  • 宁城网站建设磁力宝
  • 找人做彩票网站多少钱茶叶网站flash模板
  • 海口制作网站企业深圳网站建设seo推广优化
  • 东莞建设质监网站建设网站方式有哪些
  • 中学网站建设书最好的网站设计开发公司
  • 下载网站源码聊城seo培训