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 174... Line 174...
174
                p->val = atoi(argv[argp++]);
174
                p->val = atoi(argv[argp++]);
175
                p->used = 1 << i;
175
                p->used = 1 << i;
176
                q->next = p;
176
                q->next = p;
177
                q = p;
177
                q = p;
178
        }
178
        }
179
       
179
 
180
        printf("Processing ");
180
        printf("Processing ");
181
        for (p = results[0]; p; p=p->next)
181
        for (p = results[0]; p; p=p->next)
182
                printf("%d ", p->val);
182
                printf("%d ", p->val);
183
        printf(". Goal : %d\n", goal);
183
        printf(". Goal : %d\n", goal);
184
       
184
 
185
        /* 0) results composed by 1 base number
185
        /* 0) results composed by 1 base number
186
         * = res[0] */
186
         * = res[0] */
187
        for (p = results[0]; p->next; p=p->next)
187
        for (p = results[0]; p->next; p=p->next)
188
                resultest(p);
188
                resultest(p);
189
 
189
 
Line 243... Line 243...
243
        for (i=0; i<6; i++)
243
        for (i=0; i<6; i++)
244
        {
244
        {
245
                p = results[i];
245
                p = results[i];
246
                while (p)
246
                while (p)
247
                {
247
                {
248
                        if (abs(p->val-goal)<min)
248
                        if (p->val-goal<min)
249
                        {
249
                        {
250
                                best = p;
250
                                best = p;
251
                                min = abs(p->val-goal);
251
                                min = p->val-goal;
252
                        }
252
                        }
253
                        p = p->next;
253
                        p = p->next;
254
                }
254
                }
255
        }
255
        }
256
        printf("NOTFOUND %d %d\n", best->val, min);
256
        printf("NOTFOUND %d %d\n", best->val, min);