hdu2601
/* 题意:给n 求满足i*j+i+j=n(0<i<=j)方案数 思路:xy+x+y=n (x+1)(y+1)=x*y+x+y+1=n+1; 即求n+1的因子对数 参考:https://blog.csdn.net/Puppettt/article/details/83030925?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522172096421916800182136946%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=172096421916800182136946&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-2-83030925-null-null.142^v100^pc_search_result_base8&utm_term=hdu2601&spm=1018.2226.3001.4187 */ import java.util.Scanner; public class hdu2601 { public static void main(String[] args) { // TODO 自动生成的方法存根 Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for (int i = 0; i < T; i++) { double num = sc.nextDouble(); num++; int ans = 0; int cs; cs = (int) Math.sqrt(num); for (int j = 2; j <= cs; j++) { if (num%j==0) { ans++; } } System.out.println(ans); } sc.close(); } }