-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathB.java
More file actions
29 lines (27 loc) · 746 Bytes
/
B.java
File metadata and controls
29 lines (27 loc) · 746 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
import java.io.*;
import java.util.*;
import java.math.*;
public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = (new BigInteger(sc.next())).toString(16);
int res = 0;
for(int i = 0; i < s.length(); i++) {
switch (s.charAt(i)) {
case '0':
case '4':
case '6':
case '9':
case 'a':
case 'd':
res += 1;
break;
case '8':
case 'b':
res += 2;
break;
}
}
System.out.println(res);
}
}