Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let lastSector = input.shift();
- let countOfRows = +input.shift();
- let countOfPlaceOfOddRows = +input.shift();
- let totalCountOfPlace = 0;
- let test = lastSector.charCodeAt(0);
- for (let i = 65; i <= lastSector.charCodeAt(0); i++) {
- for (let j = 97; j <= 96 + countOfRows; j++) {
- if ((j - 96) % 2 == 1) {
- for (let k = 1; k <= countOfPlaceOfOddRows; k++) {
- console.log(`${String.fromCharCode(i)}${k}${String.fromCharCode(j)}`);
- totalCountOfPlace++;
- }
- } else {
- for (let k = 1; k <= countOfPlaceOfOddRows + 2; k++) {
- console.log(`${String.fromCharCode(i)}${k}${String.fromCharCode(j)}`);
- totalCountOfPlace++;
- }
- }
- }
- countOfRows++;
- }
- console.log(`${totalCountOfPlace}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement