Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let a = Number(input.shift());
- let b = Number(input.shift());
- let maxCountPass = Number(input.shift());
- let output = '';
- let counter = 0;
- let firstLetter = 35;
- let secondLetter = 64;
- for (let j = 1; j <= a; j++) {
- for (let k = 1; k <= b; k++) {
- if (counter >= maxCountPass) {
- break;
- }
- let strJ = String.fromCharCode(firstLetter);
- let strK = String.fromCharCode(secondLetter);
- output += `${strJ}${strK}${j}${k}${strK}${strJ}|`;
- firstLetter++;
- secondLetter++;
- counter++;
- if (firstLetter >= 55) {
- firstLetter = 35;
- }
- if (secondLetter >= 96) {
- secondLetter = 64;
- }
- }
- }
- console.log(output);
- }
- solve( ['20', '50', '10'])
Add Comment
Please, Sign In to add comment