Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. function test(input){
  2. let num = Number(input[0]);
  3. let counter = 0;
  4. let ticketCode = 0;
  5. let ticketSum = 0;
  6.  
  7. for(let x1 = 'B'.charCodeAt(); x1 <= 'L'.charCodeAt(); x1+=2){
  8. for(let x2 = 'f'.charCodeAt(); x2 >= 'a'.charCodeAt(); x2--){
  9. for(let x3 = 'A'.charCodeAt(); x3 <= 'C'.charCodeAt(); x3++){
  10. for(let x4 = 1; x4 <= 10; x4++){
  11. for(let x5 = 10; x5 >=1; x5--){
  12. counter++
  13. if(num === counter){
  14. ticketCode = String.fromCharCode(x1) + String.fromCharCode(x2) + String.fromCharCode(x3) + x4 +x5;
  15. ticketSum = x1+x2+x3+x4+x5
  16. }
  17. }
  18. }
  19. }
  20. }
  21. }
  22. console.log(`Ticket combination: ${ticketCode}\nPrize: ${ticketSum} lv.`)
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement