例如:{-5, -1, 0, 1, 2, 3, 4, 7, 8,10} ,m=5,那么满足条件的pairs: (-5,10) (1, 4) (2, 3)
void printPair(int A[], int N, int target)
{
int i, j;
i = 0, j = N - 1;
while (i <= j)
{
if (A[i] + A[j] > target)
--j;
else if (A[i] + A[j] < target)
++i;
else
{
printf("(%d, %d)\n", A[i], A[j]);
++i;
--j;
}
}
}