PS:TLE了N次...虽然结果对了...后来看了公式才知道要枚举项数才行...

代码:

#include "stdio.h"
#include "math.h"
int main(){
 int i,j,k;
 int n,m,s,t;
 while(~scanf("%d%d",&n,&m) && (n || m)){
        t=(int)sqrt(2.0*m);
  for(;0<t;t--){
   s=m-(t-1)*t/2;
   if(s%t==0){
    printf("[%d,%d]\n",s/t,s/t+(t-1));
   }
  }
  puts("");
 }
 return 0;
}