POJ2965
题目:http://poj.org/problem?id=2965
Problem: 2965 | User: qq1203456195 | |
Memory: 172K | Time: 47MS | |
Language: C | Result: Accepted |
#include <stdio.h> int Arr[16]= { 0xf888,0xf444,0xf222,0xf111, 0x8f88,0x4f44,0x2f22,0x1f11, 0x88f8,0x44f4,0x22f2,0x11f1, 0x888f,0x444f,0x222f,0x111f }; int Sln[16],idx_Sln; int M=0x0000; int i; void fun(int idx) { if (idx>=16) { if (M==0x0000) { printf("%d\n",idx_Sln); for (i=0;i<idx_Sln;i++) printf("%d %d\n",Sln[i]/4+1,Sln[i]%4+1); } return; } //not do fun(idx+1); //do M^=Arr[idx]; Sln[idx_Sln]=idx; idx_Sln++; fun(idx+1); M^=Arr[idx]; idx_Sln--; } int main() { char ch; i=20; while (i--) { scanf("%c",&ch); if (ch=='+') {M=M<<1;M^=1;}//Locked if (ch=='-') {M=M<<1;}//Open } fun(0); return 1; }
![字节跳动内推](https://img2020.cnblogs.com/blog/323808/202004/323808-20200415172728571-1992447742.jpg)
找我内推: 字节跳动各种岗位
作者:
ZH奶酪(张贺)
邮箱:
cheesezh@qq.com
出处:
http://www.cnblogs.com/CheeseZH/
*
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。