Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function az(input) {
- let arrOfNums = input.map(row=>row.split(' ').map(Number));
- let matrix1 = arrOfNums.shift();
- let result = parseInt(1);
- if (arrOfNums[0] % 2 === 0) {
- result = 0;
- }
- for (let i = 0; i < input[0]; i += 1) {
- if (arrOfNums[i] % 2 == 0) {
- result += parseInt(arrOfNums[i]);
- i += 1;
- }
- else {
- result *= parseInt(arrOfNums[i]);
- }
- if (result > 1024) {
- result %= 1024;
- }
- }
- console.log(result);
- }
- az(['10', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0']);
- az(['9', '9', '9', '9', '9', '9', '9', '9', '9', '9']);
- az(['4', '2', '4', '6', '8']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement