fork(2) download
  1. import java.io.*;
  2. import java.util.*;
  3. import java.text.*;
  4. import java.math.*;
  5. import java.util.regex.*;
  6.  
  7. class Solution {
  8.  
  9. public static void main(String[] args) {
  10. try
  11. {
  12. //DataInputStream in = new DataInputStream(System.in);
  13. Scanner sc = new Scanner(System.in);
  14. int T = sc.nextInt();
  15. while(T>0)
  16. {
  17. int N = sc.nextInt();
  18.  
  19. if(N%2 == 1)
  20. {
  21. System.out.println('0');
  22. }
  23. else
  24. {
  25. int count=0;
  26. int i=1;
  27. int t =(int) Math.sqrt(N);
  28. while(i<=t)
  29. {
  30. if(N%i == 0)
  31. {
  32. if(i%2 == 0)
  33. count += 1;
  34. int k = N/i;
  35. if((k!=i) && (k%2 == 0))
  36. count += 1;
  37. }
  38. i=i+1;
  39. }
  40. System.out.println(count);
  41. }
  42. }
  43. T = T - 1;
  44. }
  45. catch(Exception e)
  46. {}
  47. }
  48. }
Success #stdin #stdout 0.14s 321088KB
stdin
2
9
8
stdout
0
3