Created
January 5, 2012 14:30
-
-
Save catupper/1565497 to your computer and use it in GitHub Desktop.
onoff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| int table; | |
| int solve(int x){ | |
| int n=table,i,y=(1<<25)-1,z=(1<<25)-1; | |
| for(i=0;i<25;i+=5)y-=1<<i; | |
| for(i=4;i<25;i+=5)z-=1<<i; | |
| y&=x; | |
| z&=x; | |
| n^=x; //真ん中 | |
| n^=x<<5; //上 | |
| n^=x>>5; //下 | |
| n^=y>>1; //右 | |
| n^=z<<1; //左 | |
| if((n&((1<<25)-1))==((1<<25)-1)) return n; | |
| else return 0; | |
| } | |
| void five(int x){ //出力 | |
| int i; | |
| for(i=0;i<25;i++){ | |
| printf("%d",x>>(24-i)&1); | |
| if(i%5==4)puts(""); | |
| } | |
| } | |
| int main(){ | |
| int n,m; | |
| for(n=0;n<25;n++){ | |
| scanf("%d",&m); | |
| table<<=1; | |
| table+=m; | |
| } | |
| for(n=0;n<(1<<25);n++){ | |
| if(solve(n))break; | |
| } | |
| five(n); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment