To check : for all x in imgF, F(x) = x
- #include<cstdio>
- #include<cstdlib>
- #include<algorithm>
- #include<cstring>
- #include<vector>
- #include<utility>
- #include<map>
- #include<set>
- #include<queue>
- #include<cmath>
- using namespace std;
- typedef long long int int64;
- char str[1000];
- const int fil = (1<<0) + (1<<1) + (1<<2) + (1<<4) + (1<<5) + (1<<6);
- int make(int a0, int a1, int a2, int a3, int a4, int a5, int a6){
- return (a0<<0)+(a1<<1)+(a2<<2)+(a3<<3)+(a4<<4)+(a5<<5)+(a6<<6);
- }
- int g(int x){ return str[x] == '1'; }
- int f(int x){
- //printf("f(%d)\n", x);
- return (x&fil)|(g(x)<<3);
- }
- // ***
- // ****
- //*****
- // ****
- // ***
- void prt(int x){
- for(int lx = 0;lx < 7;lx++)
- printf("%d", (x>>lx)&1);
- return;
- }
- int main()
- {
- for(;;){
- scanf("%s", str);
- if(str[0] == '#') break;
- // Find Image
- bool check = true;
- for(int lx = 0;lx < (1<<19) and check;lx++){
- int p[19];
- for(int pp = 0;pp < 19;pp++){ p[pp] = (lx>>pp)&1; }
- int img = make(g(make(p[18], p[15], p[17], p[14], p[10], p[13], p[9])),
- g(make(p[15], p[11], p[14], p[10], p[6], p[9], p[5])),
- g(make(p[17], p[14], p[16], p[13], p[9], p[12], p[8])),
- g(make(p[14], p[10], p[13], p[9], p[5], p[8], p[4])),
- g(make(p[10], p[6], p[9], p[5], p[2], p[4], p[1])),
- g(make(p[13], p[9], p[12], p[8], p[4], p[7], p[3])),
- g(make(p[9], p[5], p[8], p[4], p[1], p[3], p[0])));
- //prt(img); printf(" -> "); prt(f(img)); puts("");
- if(img != f(img))
- check = false;
- }
- puts(check ? "yes":"no");
- }
- return 0;
- }
沒有留言:
張貼留言