上幼兒班沒夠,還想蹲班,幼稚的問題發發發!

2021-09-11 19:05:53 字數 3556 閱讀 9743

// () - () = 1

// () - () = 2

// () + () = 7

// () + () = 9

// () = 1, 2, 3, 4, 5, 6, 7, 8

//試**決上面的問題,但是沒有好的演算法只好自己編了乙個,這個演算法真的能行嗎?

//好幼稚的想法,好糟糕的演算法,好討厭的腦筋急轉彎——網上查了一下居然是這樣。

// () = 1, 2, 3, 4, 5, 7, 8, 9 把6翻轉過來就行了。

#include #include using namespace std;

bool my1(const int *y, char *c);

bool my2(const int *y, char *c);

bool my7(const int *y, char *c);

bool my9(const int *y, char *c);

int cmp_c(char *cc);

int create_table(unsigned short *c0, unsigned short *cc, unsigned short *c1, unsigned short *c2, unsigned short *c7, unsigned short *c9);

int c_e_t(unsigned int *end_table, unsigned int *cc, unsigned int *c0);

int main(void) ;

// const int x[8] = ; 這樣的組合形式與上面的不同,所以要改迴圈次數。

char c1[16] = ;

char c2[16] = ;

char c7[16] = ;

char c9[16] = ;

char c0[200];

char cc[200];

char end_table[7 * 6 * 4 * 3 * 8 + 4];

int i = 0;

// printf("%d\n", cmp_c(c1));

my1(x, c1);

my2(x, c2);

my7(x, c7);

my9(x, c9);

printf("%s\n", c1);

printf("%s\n", c2);

printf("%s\n", c7);

printf("%s\n", c9);

// printf("######################################\n");

create_table((unsigned short *)c0, (unsigned short *)cc, (unsigned short *)c1, (unsigned short *)c2, (unsigned short *)c7, (unsigned short *)c9);

// printf("######################################\n");

// printf("%s\n", cc);

// printf("######################################\n");

// printf("%s\n", c0);

c_e_t((unsigned int *)end_table, (unsigned int *)cc, (unsigned int *)c0);

// printf("%s\n", end_table);

printf("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");

for(i = 0; i < 7 * 6 * 4 * 3 * 8; i += 8)

} if(i == 7 * 6 * 4 * 3 * 8)

printf("not found answer!!!\n");

printf("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");

}bool my7(const int *y, char *c)

j++;

} j = ++tmp;

i++;

} c[k] = '\0';

// printf("\n");

return 1;

}bool my1(const int *y, char *c)

j--;

} j = --tmp;

i--;

} c[k] = '\0';

// printf("\n");

return 1;

}bool my2(const int *y, char *c)

j--;

} j = --tmp;

i--;

} c[k] = '\0';

// printf("\n");

return 1;

}bool my9(const int *y, char *c)

j++;

} j = ++tmp;

i++;

} c[k] = '\0';

// printf("\n");

return 1;

}int cmp_c(char *cc)

} } return -2;

}int create_table(unsigned short *c0, unsigned short *cc, unsigned short *c1, unsigned short *c2, unsigned short *c7, unsigned short *c9)

} for(i = 0; i < 3; i++)

} ((unsigned char *)cc)[42 * 4 + 0] = 'e';

((unsigned char *)cc)[42 * 4 + 1] = 'n';

((unsigned char *)cc)[42 * 4 + 2] = 'd';

((unsigned char *)cc)[42 * 4 + 3] = '\0';

((unsigned char *)c0)[48] = 'e';

((unsigned char *)c0)[49] = 'n';

((unsigned char *)c0)[50] = 'd';

((unsigned char *)c0)[51] = '\0';

return 0;

}int c_e_t(unsigned int *end_table, unsigned int *cc, unsigned int *c0)

} ((unsigned char *)end_table)[42 * 12 * 8 + 0] = 'e';

((unsigned char *)end_table)[42 * 12 * 8 + 1] = 'n';

((unsigned char *)end_table)[42 * 12 * 8 + 2] = 'd';

((unsigned char *)end_table)[42 * 12 * 8 + 3] = '\0';

return 0;

}