-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask06.java
More file actions
35 lines (27 loc) · 1022 Bytes
/
Task06.java
File metadata and controls
35 lines (27 loc) · 1022 Bytes
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
34
35
import java.util.Scanner;
public class Task06 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
String garbage = in.nextLine();
for(int i=0; i<T; i++) {
String serial = in.nextLine();
String[] parts = serial.split("");
int[] serialparts = new int[parts.length];
for(int j=0; j<parts.length; j++) serialparts[j] = Integer.parseInt(parts[j]);
int evenSum, oddSum;
evenSum = oddSum = 0;
for(int b=0; b<serialparts.length; b+=2) evenSum+=serialparts[b];
for(int o=1; o<serialparts.length; o+=2) {
int x = serialparts[o]*2;
if(x>=10) {
oddSum += x/10 + x%10;
} else {
oddSum += x;
}
}
if(((evenSum+oddSum) % 2)==0) System.out.println("true");
else System.out.println("false");
}
}
}