Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package SherlockAndDivisors;
- import java.io.*;
- import java.math.*;
- import java.text.*;
- import java.util.*;
- import java.util.regex.*;
- public class Solution
- {
- static int a;
- static int divisors(int n)
- {
- int temp = 0;
- a = 0;
- for(int i = n; i >= (int)Math.sqrt(n);--i)
- {
- if(n % i == 0 && i % 2 == 0)
- {
- ++a;
- temp = n/i;
- if(temp == (int)Math.sqrt(n))
- {
- ++a;
- break;
- }
- if(temp % 2 == 0)
- ++a;
- }
- }
- return a;
- }
- private static final Scanner scanner = new Scanner(System.in);
- public static void main(String[] args) throws IOException
- {
- int t = scanner.nextInt();
- for (int tItr = 0; tItr < t; tItr++)
- {
- int n = scanner.nextInt();
- int result = divisors(n);
- System.out.println(result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement