Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement