Subversion Repositories wimsdev

Rev

Rev 2143 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2143 Rev 8837
Line 178... Line 178...
178
                p->val = atoi(argv[argp++]);
178
                p->val = atoi(argv[argp++]);
179
                p->used = 1 << i;
179
                p->used = 1 << i;
180
                q->next = p;
180
                q->next = p;
181
                q = p;
181
                q = p;
182
        }
182
        }
183
       
183
 
184
        printf("Processing ");
184
        printf("Processing ");
185
        for (p = results[0]; p; p=p->next)
185
        for (p = results[0]; p; p=p->next)
186
                printf("%d ", p->val);
186
                printf("%d ", p->val);
187
        printf(". Goal : %d\n", goal);
187
        printf(". Goal : %d\n", goal);
188
       
188
 
189
        /* 0) results composed by 1 base number
189
        /* 0) results composed by 1 base number
190
         * = res[0] */
190
         * = res[0] */
191
        for (p = results[0]; p->next; p=p->next)
191
        for (p = results[0]; p->next; p=p->next)
192
                resultest(p);
192
                resultest(p);
193
 
193
 
Line 247... Line 247...
247
        for (i=0; i<6; i++)
247
        for (i=0; i<6; i++)
248
        {
248
        {
249
                p = results[i];
249
                p = results[i];
250
                while (p)
250
                while (p)
251
                {
251
                {
252
                        if (abs(p->val-goal)<min)
252
                        if (p->val-goal<min)
253
                        {
253
                        {
254
                                best = p;
254
                                best = p;
255
                                min = abs(p->val-goal);
255
                                min = p->val-goal;
256
                        }
256
                        }
257
                        p = p->next;
257
                        p = p->next;
258
                }
258
                }
259
        }
259
        }
260
        printf("NOTFOUND %d %d\n", best->val, min);
260
        printf("NOTFOUND %d %d\n", best->val, min);