当前位置:网站首页>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
边栏推荐
- u-boot in u-boot, dm-pre-reloc
- 【微信小程序】WXML模板语法-条件渲染
- Day019 Method overriding and introduction of related classes
- 使用二维码解决固定资产管理的难题
- Understanding and use of C# on set() and get() methods
- Homework 8.4 Interprocess Communication Pipes and Signals
- 二叉树基本性质+oj题解析
- The role of DataContext in WPF
- number_gets the specified number of decimals
- What is ASEMI photovoltaic diode, the role of photovoltaic diode
猜你喜欢
随机推荐
Is the NPDP certificate high in gold content?Compared to PMP?
Redis哨兵模式配置文件详解
请写出SparkSQL语句
电话溥功能
Feature preprocessing
LeetCode:1403. 非递增顺序的最小子序列【贪心】
C++ core programming
Flutter学习三-Flutter基本结构和原理
Flutter Learning 4 - Basic UI Components
uboot enable debug printing information
Flutter学习4-基本UI组件
社区分享|腾讯海外游戏基于JumpServer构建游戏安全运营能力
flex布局青蛙游戏通关攻略
uva1325
【转】什么是etcd
仪表板展示 | DataEase看中国:数据呈现中国资本市场
AUTOCAD - dimension association
entry point injection
Develop your own node package
u-boot中的u-boot,dm-pre-reloc


![[cesium] element highlighting](/img/99/504ca9802db83eb33bc6d91b34fa84.png)






