标签:
#include<stdio.h>
int main()
{
int i,m,x,y,n,ans,num;
while(~scanf("%d%d",&n,&m)&&n&&m)
{
ans=0;
for(i=1; i<n; i++)
{
ans+=i;
y=i;
if(ans>=m) break;
}
if(ans==m) num=i;
else num=i-1;
for(i=num; i>0; i--)
{
x=(2*m/i-(i-1))/2;
y=(2*m/i+(i-1))/2;
if((x+y)*(y-x+1)==2*m)
printf("[%d,%d]\n",x,y);
}
printf("\n");
}
return 0;
}
标签:
原文地址:http://blog.csdn.net/xinag578/article/details/45565471