当前位置:网站首页>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
边栏推荐
- number_gets the specified number of decimals
- Flutter学习三-Flutter基本结构和原理
- 逆向理论知识4
- 数字孪生技术在电力系统中的应用现状
- for..in和for..of的区别
- dedecms报错The each() function is deprecated
- 【cesium】加载并定位 3D Tileset
- Dephi逆向工具Dede导出函数名MAP导入到IDA中
- After controlling the export file in MySQL, it becomes \N. Is there any solution?
- 结构光三维重建(二)线结构光三维重建
猜你喜欢

What is ASEMI photovoltaic diode, the role of photovoltaic diode

Visibility of multi-column attribute column elements: display, visibility, opacity, vertical alignment: vertical-align, z-index The larger it is, the more it will be displayed on the upper layer

数字孪生技术在电力系统中的应用现状

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

mutillidae download and installation

jvm 三 之堆与栈

ansible各个模块详解

span标签和p标签的区别

什么是ASEMI光伏二极管,光伏二极管的作用

WPF中DataContext作用
随机推荐
Shell(4)条件控制语句
Structured light 3D reconstruction (1) Striped structured light 3D reconstruction
How does the Flutter TapGestureRecognizer work
[informix] Resolving startup errors and solutions
Flutter学习5-集成-打包-发布
基于Web的商城后台管理系统的设计与实现
Excel画图
【学习笔记之菜Dog学C】动态内存管理之经典笔试题
Flutter real machine running and simulator running
入口点注入
how to measure distance from point to face in creo
结构光三维重建(一)条纹结构光三维重建
雷克萨斯lm的安全性到底体现在哪里?一起来看看吧
Flutter学习4-基本UI组件
How to quickly upgrade your Taobao account to a higher level
[Nine Lectures on Backpacks - 01 Backpack Problems]
Mvi架构浅析
Flutter学习2-dart学习
Dephi reverse tool Dede exports function name MAP and imports it into IDA
【cesium】Load and locate 3D Tileset