SHARE
TWEET

genre de rendu monnaie

roronoa Jul 18th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  noteTypes = readline().split(' ').map(a=>1*a).reverse();
  2.  N = parseInt(readline());
  3. let myMap = new Map();
  4. for(let n of noteTypes)
  5. {
  6.     myMap.set(n,0);
  7. }
  8. while(N != 0)
  9. {
  10.     for(let x of noteTypes)
  11.     {
  12.         //console.log('ici',x)
  13.         while(N >= x)
  14.         {
  15.             N -= x;
  16.             myMap.set(x,myMap.get(x)+1);
  17.         }
  18.     }
  19. }
  20. r = '';
  21. for (var [cle, valeur] of myMap)
  22. {
  23.     if(valeur != 0)
  24.         r += valeur + 'x' + cle+ ' ';
  25. }
  26. console.log(r.trim());
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top