当前位置:网站首页>1068找到更多的硬币
1068找到更多的硬币
2022-08-05 05:05:00 【Brosto_Cloud】
Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However, there was a special requirement of the payment:for each bill, she must pay the exact amount. Since she has as many as 104 coins with her, she definitely needs your help. You are supposed to tell her, for any given amount of money, whether or not she can find some coinsto pay for it.
Input Specification:
Each input file contains one test case. For each case, the first line contains 2 positive numbers: N (≤104, the total number of coins) and M(≤102, the amount of money Eva has to pay). The second line contains N face values of the coins, which are all positive numbers. All the numbers in a line are separated by a space.
Output Specification:
For each test case, print in one line the face values V1≤V2≤⋯≤Vk such that V1+V2+⋯+Vk=M. All the numbersmust be separated by a space, and there must be no extra space at the end of the line. If such a solution is not unique, output the smallest sequence. If there is no solution, output "No Solution" instead.
Note: sequence {A[1], A[2], ...} is said to be "smaller" than sequence {B[1], B[2], ...} if there exists k≥1 such that A[i]=B[i] for all i In the beginning, using dfs+pruning, the test point 6 timed out, and it is fine to judge that the sum of all coins is less than m:Sample Input 1:
8 95 9 8 7 2 3 4 1Sample Output 1:
1 3 5Sample Input 2:
4 87 2 4 3Sample Output 2:
No Solution#include
边栏推荐
- Day14 jenkins deployment
- Flutter TapGestureRecognizer 如何工作
- Cron(Crontab)--use/tutorial/example
- Understanding and use of C# on set() and get() methods
- entry point injection
- Flutter真机运行及模拟器运行
- 软件管理rpm
- 8.04 Day35-----MVC three-tier architecture
- 8.04 Day35-----MVC三层架构
- Talk about 20 common problems in data governance
猜你喜欢

Develop a highly fault-tolerant distributed system

Flutter学习5-集成-打包-发布

结构光三维重建(一)条纹结构光三维重建

Use IDEA to connect to TDengine server

App rapid development and construction experience: the importance of small programs + custom plug-ins

dedecms后台生成提示读取频道信息失败的解决方法

There are a lot of 4T hard drives remaining, prompting "No space left on device" insufficient disk space

Detailed explanation of Mysql's undo log

Flutter 父子组件如何都能收到点击事件

【cesium】3D Tileset 模型加载并与模型树关联
随机推荐
Day14 jenkins deployment
大学物理---质点运动学
判断语句_switch与case
【cesium】Load and locate 3D Tileset
Why did you start preparing for the soft exam just after the PMP exam?
C language - vernacular to understand the original code, inverse code and complement code
Mvi架构浅析
Develop your own node package
【cesium】元素高亮显示
Day14 jenkins部署
Redis哨兵模式配置文件详解
[BSidesCF 2019] Kookie
【cesium】加载并定位 3D Tileset
Excel画图
u-boot debugging and positioning means
u-boot调试定位手段
University Physics---Particle Kinematics
Redis - 13. Development Specifications
UVA10827
ESP32 485光照度