You are viewing a single comment's thread. Return to all comments →
This worked for me.
import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Solution {
public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t--!=0){ long n=sc.nextLong(); int count=0; for(long i=2;i<=Math.sqrt(n);i++){ if(n%i==0 && i%2==0) count++; if(n%(n/i)==0 && ((n/i)!=i) && ((n/i)%2==0)) count++; } if(n%2==0) count++; System.out.println(count); } }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Divisors
You are viewing a single comment's thread. Return to all comments →
This worked for me.
import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Solution {
}