Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function test(input){
- let num = Number(input[0]);
- let counter = 0;
- let ticketCode = 0;
- let ticketSum = 0;
- for(let x1 = 'B'.charCodeAt(); x1 <= 'L'.charCodeAt(); x1+=2){
- for(let x2 = 'f'.charCodeAt(); x2 >= 'a'.charCodeAt(); x2--){
- for(let x3 = 'A'.charCodeAt(); x3 <= 'C'.charCodeAt(); x3++){
- for(let x4 = 1; x4 <= 10; x4++){
- for(let x5 = 10; x5 >=1; x5--){
- counter++
- if(num === counter){
- ticketCode = String.fromCharCode(x1) + String.fromCharCode(x2) + String.fromCharCode(x3) + x4 +x5;
- ticketSum = x1+x2+x3+x4+x5
- }
- }
- }
- }
- }
- }
- console.log(`Ticket combination: ${ticketCode}\nPrize: ${ticketSum} lv.`)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement