“21天好习惯”第一期-1 HDU2058 The sum problem

 题目链接:HUD2058 The sum problem

#include <stdio.h>
int main()
{
    int m,n;    
    int len,a;
    while(scanf("%d%d",&n,&m)!=EOF&&(m||n))
    {
        len=sqrt(2.0*m);
        while(len>0)
        {
            a=m/len+(1-len)/2;
            if((a+a+(len-1))*len/2==m)
                printf("[%d,%d]\n",a,a+len-1);    
            len--;
        }
        printf("\n"); 
    }
    return 0;
}

上一篇:yum 与rpm的区别与联系


下一篇:2021CCPC网络赛E Easy Math Problem