就是等差数列,模拟会TLE的
#include <stdio.h>
#include <math.h>
int main()
{
int cases=0;
while (scanf("%d", &cases) != EOF){
while (cases--){
int k;
int n, i, count=0;
scanf("%d%d",&k, &n);
int num= (int)sqrt(2*n+0.1)+1;
for ( i = 1; i < num; i++ )
{
if( (2*n%i)==0 && (2*n/i+1-i) > 0 && (2*n/i+1-i)%2 == 0)
count++;
}
printf("%d %d\n", k, count-1);
}
}
return 0;
}