编程介的小学生
2019-02-25 20:21困难度的控制方面的一个算法,根据问题的id计算困难度,采用C语言进行
Problem Description
LL is very sensitive to the difficulty of ACM problems. He can assign each problem a positive integer from [1,10000000] to denote its difficulty ( although he has only ACed about 1000 problems ^_^ ). Now, there are N problems in his mind. He want to choose some of them to hold a contest and the total difficulty of all problems in the contest is as near as possible to M.
Input
For each case, the first line is two positive integers N and M (1<=N<=26). Followed by N lines. Each line contains the problem's ID ( a single capital letter ) and its difficulty.
Output
For each case, ouput how many and which problems he should choose in the format of the sample. If more than one combinations of problems reach the request, output the one which comes earliest in lexicography order.
Sample Input
3 10
A 4
B 12
C 8
Sample Output
2
A C
- 点赞
- 回答
- 收藏
- 复制链接分享
0条回答
为你推荐
- 【c语言/链表】两个有序单链表合成为一个有序单链表,自己写的代码运行出错,求助
- c语言
- 1个回答
- 这是一个关于C语言输入输出函数的问题
- c语言
- 4个回答
- 一个有关九宫格键盘输入字母的方式的一个算法问题,采用C语言计算
- r语言
- Golang
- erlang
- 1个回答
- 采用算法计算一个几何问题,计算围栏的长度怎么用C语言程序的实现的方式
- r语言
- Golang
- erlang
- 1个回答
- 用C语言解决下面一个邻接表方面的算法的问题怎么实现的
- r语言
- Golang
- erlang
- 1个回答