Advertisement
Spocoman

Movie Tickets

Feb 25th, 2022
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function movieTickets(input) {
  2.     let a1 = Number(input[0]);
  3.     let a2 = Number(input[1]);
  4.     let n = Number(input[2]);
  5.  
  6.     for (let i = a1; i < a2; i++) {
  7.         for (let x = 1; x < n; x++) {
  8.             for (let y = 1; y <= (n / 2 - 1); y++) {
  9.                 if (i % 2 === 1 && (i + x + y) % 2 === 1) {
  10.                     console.log(`${String.fromCharCode(i)}-${x}${y}${i}`);
  11.                 }
  12.             }
  13.         }
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement