SHARE
TWEET

Untitled

a guest Dec 14th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.   let lastSector = input.shift();
  3.   let countOfRows = +input.shift();
  4.   let countOfPlaceOfOddRows = +input.shift();
  5.   let totalCountOfPlace = 0;
  6.   let test = lastSector.charCodeAt(0);
  7.  
  8.   for (let i = 65; i <= lastSector.charCodeAt(0); i++) {
  9.     for (let j = 97; j <= 96 + countOfRows; j++) {
  10.       if ((j - 96) % 2 == 1) {
  11.         for (let k = 1; k <= countOfPlaceOfOddRows; k++) {
  12.           console.log(`${String.fromCharCode(i)}${k}${String.fromCharCode(j)}`);
  13.           totalCountOfPlace++;
  14.         }
  15.       } else {
  16.         for (let k = 1; k <= countOfPlaceOfOddRows + 2; k++) {
  17.           console.log(`${String.fromCharCode(i)}${k}${String.fromCharCode(j)}`);
  18.           totalCountOfPlace++;
  19.         }
  20.       }
  21.     }
  22.  
  23.     countOfRows++;
  24.   }
  25.  
  26.   console.log(`${totalCountOfPlace}`);
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top