Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ticketCombination(input) {
- let n = Number(input);
- for (let a = 'B'.charCodeAt(0); a <= 'L'.charCodeAt(0); a += 2) {
- for (let b = 'f'.charCodeAt(0); b >= 'a'.charCodeAt(0); b--) {
- for (let c = 'A'.charCodeAt(0); c <= 'C'.charCodeAt(0); c++) {
- for (let d = 1; d <= 10; d++) {
- for (let e = 10; e > 0; e--) {
- if (--n == 0) {
- console.log(`Ticket combination: ${String.fromCharCode(a, b, c)}${d}${e}`);
- console.log(`Prize: ${a + b + c + d + e} lv.`);
- return;
- }
- }
- }
- }
- }
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement