http://acm.hdu.edu.cn/showproblem.php?pid=2601
n=i*j+i+j==>n+1=(i+1)*(j+1)==>2<=i+1<=sqrt(n+1);
/* 2011-9-22 author:BearFly1990 */ package acm.hdu.tests; import java.io.BufferedInputStream; import java.util.Scanner; public class HDU_2601 { public static void main(String[] args) { Scanner in = new Scanner(new BufferedInputStream(System.in)); //java.text.DecimalFormat df = new java.text.DecimalFormat("00.00"); int t = in.nextInt(); while(t-- > 0){ long n = in.nextLong(); n++; int temp = (int) Math.sqrt(n); int c = 0; for(int i = 2; i <= temp; i++){ if( n % i == 0)c++; } System.out.println(c); } } }