#include "stdafx.h"
#include "stdlib.h"
#include <math.h>
int main(int argc, char* argv[])
{
int n,middle,i;
n = atoi(argv[1]);
if(n <2)
{
printf("please input the number larger than 2 ");
return -1;
}
middle = (int)sqrt(2*n); // the min sum of i numbers is (i+1)*i/2
for(i=2; i<=middle; i++)
{
if( i % 2 ==1)
{
if( n % i ==0) // 15 % 3
{
int min, max,middle;
middle=n/i;
min=middle - i/2;
max=middle + i/2;
printf("%d could added by %d numbers for %d to %d /n",n,i,min,max);
}
}else // i is even
{
if( (n-i/2) % i ==0)
{
int min,max,middle;
middle=(n -i/2)/i;
min=middle-(i-1)/2;
max=middle+(i-1)/2+1;
printf("%d could added by %d numbers for %d to %d /n",n,i,min,max);
}
}
}
return 0;
}