编程介的小学生 2017-12-03 04:59 采纳率: 20.5%
浏览 730
已采纳

Dart Challenge

Problem Description
Clark and Harry are siblings. As they had been rivals since their early childhood, their father decided that both should concentrate on a different sport when they were thirteen. That way, they would not have to compete for success. Now both are twenty years old and excel in different fields: Clark plays chess while Harry participates in dart-tournaments.
Having won a series of three tournaments in a row, Harry started teasing Clark about not having as much success. Clark retorted that chess was less luck-based and thus more difficult. That offended Harry and led him to the reply that in order to play darts optimally, a lot of combinatorics are necessary. Clark returned an icy smile and the comment that memorizing all different late-games could hardly be called “combinatorics”.
This is how it came to the wager. Harry bets that he can find all possible late-games for generalized dart-boards where memorized late-games do not help him. When Clark showed him a list of possible dartboards, Harry had to admit that he probably bit off more than he can chew. As his friend, you have to help him!

A dart-board consists of different areas. Each area has an assigned score for hitting it. Each area also has a double- and a triple-field that are worth twice and three times the score of the area. The only exception is the area for the highest score: It has only a double- and no triple-field! Given the values of the different areas you have to find the number of possible scores that can be obtained with a given number of darts.

Input
The inputs start with a line containing a single integer n. Each of the n following lines contains one test case. Each test case starts with two integers 1 <= a <= 100; 1 <= k <= 50, the number of different areas on the
dart-board and the number of darts. a integers 1 <= si <= 100 follow. si is the score for hitting area i. All scores are distinct. Remember that each area has a double- and, with exception of the area with the highest score, a triple-field. It is always possible to score 0 with any given dart by not hitting the board.

Output
The output for every test case begins with a line containing “Scenario #i:”, where i is the number of the scenario counting from 1. After that, output a single line containing the number of different scores that can be obtained with k darts on the given board. Terminate each test case with an empty line.

Sample Input
3
21 3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 25
2 2 20 10
1 50 1

Sample Output
Scenario #1:
172

Scenario #2:
9

Scenario #3:
101

  • 写回答

1条回答 默认 最新

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

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)