【leetcode】找出给定方程的正整数解

int** findSolution(int (*customFunction)(int, int), int z, int* returnSize, int** returnColumnSizes) {
    int** arr = (int**)calloc(z,sizeof(int*));
    *returnColumnSizes = (int*)calloc(z,sizeof(int));
    int i,j,pst=0;
    for (i=1; customFunction(i,1)<=z; i++)
    {
        for (j=1; customFunction(i,j)<=z; j++)
        {
            if (customFunction(i,j) == z)
            {
                (*returnColumnSizes)[pst]=2;
                arr[pst] = (int*)calloc(2,sizeof(int));
                arr[pst][0]=i;
                arr[pst++][1]=j;
            }
        }
    }
    *returnSize=pst;
    return arr;
}
原文地址:https://www.cnblogs.com/ganxiang/p/13748974.html