shunfurh
编程介的小学生
2019-02-25 20:21

困难度的控制方面的一个算法,根据问题的id计算困难度,采用C语言进行

  • Golang
  • r语言
  • erlang

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条回答