// 100_26.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
void find(int n)
{
int small = 1;
int big = 2;
int middle = (n+1)/2;
int sum = small + big;
while(small < middle)
{
if(sum == n)
printf("%d %d\n", small,big);
if(sum > n)
{
sum -= small;
small++;
}
else
{
big++;
sum += big;
}
}
}
int _tmain(int argc, _TCHAR* argv[])
{
find(15);
return 0;
}
浙公网安备 33010602011771号