-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbit.java
More file actions
31 lines (25 loc) · 853 Bytes
/
bit.java
File metadata and controls
31 lines (25 loc) · 853 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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class bit {
public static void alo() throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int input = Integer.parseInt(reader.readLine());
int i=0;
while(i<input){
int count=0;
long number = Long.parseLong(reader.readLine());
long num = number;
while(num>0){
if(num%2==1){
count++;}
num=num/2;
}
System.out.println(count);
i++;
}
}
public static void main(String[] args) throws IOException{
alo();
}
}