编程介的小学生 2017-12-02 15:16 采纳率: 20.5%
浏览 658
已采纳

Tempter of the Bone again

Problem Description
Ignatius found some bones in an ancient maze, which fascinated him a lot. However, when he picked them up, the maze began to shake, and Ignatius could feel the ground sinking. He realized that the bone was a trap, and he tried desperately to get out of this maze.
Suddenly, Ignatius heard a very very cool voice, and he recognize that it comes from Beelzebub feng5166:“I know that you like bone, and even I know your nick name is wishingbone. Today, I give you a chance to survive: there are N kinds of bones here and the number of each kind bone is enough, their weights are Wi pounds (1<=i<=N), your bag has a volume of M pounds, and I also know that you will spend 3 seconds time when you pick up any one bone. Today, you must fill up your bag as quick as you can, otherwise, the maze is your place of the death!”.
Oh, my god! Can the poor Ignatius survive? Please help him!
Note: You are guarantied that solution always exist for every test case.

Input
The input consists of multiple test cases. The first line of each test case contains two integers N and M (1 < N < 10; 0 < M < 1000000000), which denote the kinds of the bone and the capacity of the bag respectively. The next line give N integers W1…Wn (1<=wi<=100), which indicate the weights of bones
The input is terminated with two 0's. This test case is not to be processed.

Output
For each test case, print the minimal time Ignatius will spend when he can survive. One line per case.

Sample Input
2 20
1 5
0 0

Sample Output
12

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-12-03 15:48
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 echarts动画效果失效的问题。官网下载的例子。
  • ¥60 许可证msc licensing软件报错显示已有相同版本软件,但是下一步显示无法读取日志目录。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加