-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ01012.java
More file actions
33 lines (29 loc) · 772 Bytes
/
J01012.java
File metadata and controls
33 lines (29 loc) · 772 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
import java.util.*;
import java.math.*;
public class J01012 {
public static int check(int x) {
int cnt = 0;
if (x < 2) {
return 0;
}
for (int i = 1; i <= Math.sqrt(x); i ++) {
if (x % i == 0) {
if (i % 2 == 0) {
cnt += 1;
}
if ((x / i) % 2 == 0 && i != Math.sqrt(x)) {
cnt += 1;
}
}
}
return cnt;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while (n-- > 0) {
int x = sc.nextInt();
System.out.println(check(x));
}
}
}