Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function func(input){
- let K = Number(input[0]);
- let L = Number(input[1]);
- let M = Number(input[2]);
- let N = Number(input[3]);
- let count = 0;
- for (let i = K; i <= 8; i++) {
- if(count>5){
- break;
- }
- for (let j = 9; j >= L; j--) {
- for (let k = M; k <= 8 ; k++) {
- for (let l = 9; l >= N; l--) {
- let isPossible = i % 2 == 0 && k % 2 == 0 && l % 2 != 0 && j % 2 != 0;
- let firstNum = i * 10 + j;
- let secondNum = k * 10 + l;
- if(isPossible && firstNum == secondNum){
- console.log("Cannot change the same player.");
- }
- else if(isPossible && firstNum != secondNum){
- console.log(`${firstNum} - ${secondNum}`);
- }
- }
- }
- }
- count++;
- }
- }
- func(["6",
- "7",
- "5",
- "6"])
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement