Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- noteTypes = readline().split(' ').map(a=>1*a).reverse();
- N = parseInt(readline());
- let myMap = new Map();
- for(let n of noteTypes)
- {
- myMap.set(n,0);
- }
- while(N != 0)
- {
- for(let x of noteTypes)
- {
- //console.log('ici',x)
- while(N >= x)
- {
- N -= x;
- myMap.set(x,myMap.get(x)+1);
- }
- }
- }
- r = '';
- for (var [cle, valeur] of myMap)
- {
- if(valeur != 0)
- r += valeur + 'x' + cle+ ' ';
- }
- console.log(r.trim());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement