Quick actions

cmd+k|ctrl+k

Navigation

Languages

Digital Puzzle

Snippet info

Language

C

Visibility

public

Author

pheker

Created

2017-12-21T02:10:33Z

Updated

2017-12-21T02:23:13Z

#include <stdio.h>

/**
 * 
 *       6 x x
 *       x x x
 * -----------
 *       x x x
 *    x x x x
 * x 5 x 5
 * ------------
 * x x 5 x 4 x
 * 
 * 
 */

int main(void) {
    printf("Hello World!\n");
    //a1为奇数,(a1,b3其一为5)
    //b1=1,b2>1,b3>2
   int step = 0;
   for (int a1 = 1; a1 <10 ; a1 += 2) {
        for (int a2 = 0; a2 <10 ; a2++) {
            for (int b2 = 1; b2 <10 ; b2++) {
                for (int b3 = 1; b3 <10 ; b3 += 2) {
                    if(a1!=5&&b3!=5) continue;
                    step++;
                    int one = 600+a2*10+a1;
                    int two = b2*one;
                    int tree = b3*one;
                    int sum = one+two*10+tree*100;
                    // printf("[==]: 6%d%d x %d%d1 = %d\n",a2,a1,b3,b2,sum);
                    if(tree/100%10 == 5
                       &&a2+a1*b2%10 == 4
                       &&sum/1000%10 == 5){
                        printf("6%d%d x %d%d1 = %d\n",a2,a1,b3,b2,sum);
                    }
                }
            }
        }
    }
    printf("[over step]: %d\n",step);
    return 0;
}
INFO