Advertisement
31ph4n70m

Funny_Words_Generator.js

Dec 16th, 2019
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // JavaScript solution to codeabbey challenge 72
  2. process.stdin.resume();
  3. process.stdin.setEncoding('utf8');
  4.  
  5. const v1 = "22 1838911";
  6. const v2 = "3 5 5 4 6 8 8 5 3 5 4 7 6 4 3 5 5 7 7 5 8 6";
  7. const INP1 = v1.split(' ').map(Number);
  8. const INP2 = v2.split(' ').map(Number);
  9. const CON = 'bcdfghjklmnprstvwxz';
  10. const VOW = 'aeiou';
  11. const A = 445;
  12. const C = 700001;
  13. const M = 2097152;
  14. var XN = INP1[1];
  15. var LI = 0;
  16. var RSP = [];
  17. for(var wl of INP2){
  18.     WORD = "";
  19.     for (var i = 1; i <= wl; i++) {
  20.         XN = (A*XN + C) % M;
  21.         if (i % 2 === 0) {
  22.             LI = XN % 5;
  23.             WORD += VOW[LI];
  24.         } else {
  25.             LI = XN % 19;
  26.             WORD += CON[LI];
  27.         }
  28.     }
  29.     RSP.push(WORD);
  30. }
  31. console.log(RSP.join(" "));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement