-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bijele.java
33 lines (26 loc) · 1004 Bytes
/
Bijele.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package bijele;
import java.util.Scanner;
public class Bijele {
public static void main(String[] args) {
Scanner inputScanner = new Scanner(System.in);
int correctAmountOfPices[] = {1,1,2,2,2,8};
int piecesToAddOrRemove[] = {0,0,0,0,0,0};
String[] input = inputScanner.nextLine().split(" ");
int piece;
for(int i = 0; i < 6; i++) {
piece = Integer.parseInt(input[i]);
// färre
if(piece < correctAmountOfPices[i]) {
piecesToAddOrRemove[i] = correctAmountOfPices[i] - piece;
// fler
} else if(piece > correctAmountOfPices[i]) {
piecesToAddOrRemove[i] = -(piece - correctAmountOfPices[i]);
}
if(i < 5) {
System.out.print(piecesToAddOrRemove[i] + " ");
} else {
System.out.println(piecesToAddOrRemove[i]);
}
}
}
}