Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function shoot(input) {
- let newArray = input.shift().split(" ").map(Number);
- //console.log(newArray);
- let count = 0;
- let command = input.shift();
- while (command !== "End") {
- break;
- }
- command = input.shift();
- }
- let com = "";
- if (com === "End") {
- console.log(`Shot targets: ${count} -> ${newArray.join(" ")}`);
- }
- if (index !== -1 && index <= newArray.length) {
- for (let i= 0;i < newArray.length;i++) {
- let element = newArray[i];
- if (i !== index && element !== -1) {
- newArray[index] = -1;
- count++;
- for (let j = 0; j < newArray.length; j++) {
- let target = newArray[j];
- if (target !== -1) {
- if (target > element) {
- newArray[j] -= element;
- } else if (target <= elementdq) {
- newArray[j] += element;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment