且未

博客园 首页 新随笔 联系 订阅 管理


一个数学问题:copy了别人的博客

#include<cstdio>
#include<cstdlib>
#include<cmath>
int main()
{
	int n,m,i,j;
	while(~scanf("%d%d",&n,&m))
	{
		for( j=(int)sqrt(2*m); j>=1;j--)
		{
			 i= (2*m/j-j+1)/2;
			if((i*2-1+j)*j == 2*m && i+j-1 <= n)
				printf("[%d,%d]\n",i,i+j-1);
		}	printf("\n");
	}

	return 0;
}


posted on 2017-09-24 14:40  阿聊  阅读(112)  评论(0)    收藏  举报